Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problem with the code for uploading files

Status
Not open for further replies.

tkanvar

Programmer
Jun 20, 2002
5
IN
Hi,

I used the following code to upload files to the folder "C:/uploads" using aspSmartUpload. And I get "1 file uploaded" message also. But the file is not actually uploaded in to the folder. Please help me to solve this problem. I use windows 98 and Personal Web Server.

thank you
Anvar


<%
' Variables
' *********
Dim mySmartUpload
Dim intCount

' Object creation
' ***************
Set mySmartUpload = Server.CreateObject(&quot;aspSmartUpload.SmartUpload&quot;)

mySmartUpload.Upload


' sample with a physical path
intCount = mySmartUpload.Save(&quot;C:\uploads&quot;)

' Display the number of files uploaded
' ************************************
Response.Write(intCount & &quot; file uploaded.&quot;)
%>
 
Hi ...
you can try the SaveAs method of this object :
txtFileExt = mysmartupload.files(&quot;myfilename&quot;).FileExt
txtFileName = mysmartupload.files(&quot;myfilename&quot;).FileName
txtFileName = txtFileName & &quot;.&quot; & txtFileExt
mySmartUpload.files(&quot;myfilename&quot;).saveas &quot;C:\uploads\&quot; & txtFileName
the &quot;myfilename&quot; is the name of the file input in your form.
----
TNX.
E.T.
 
Hi ehsant ,

For that I got the following error message.
Invalid Files Name 'myfilename' (Error 1205)

And I added the line
Dim myfilename

The same error message comes
I dont know what to do now. Please help me

And anyway the save mentioned in the first message should have worked, Am I right?
Then what is the problem with that code? any idea?
Please help me on that also.

thanks
Anvar





 
Hi ...
As i said, the &quot;myfilename&quot; is the name of the file input in your form.
in your form, you have an input onject with a name which has a brows button.
when you push the button, you select a file from you computer and then submit your form which this asp will be called.
&quot;myfilename&quot; is the name of that object.
for example, you have this in your form name myasp1.asp:
<form name=&quot;something&quot; action=&quot;upload.asp&quot; method=&quot;post&quot;>
<input type=&quot;File&quot; name=&quot;myfilename&quot; size=&quot;53&quot; class=&quot;NormalInput&quot;>
</form>

then you have this code in your upload.asp :

Dim mySmartUpload

' Object creation
' ***************
Set mySmartUpload = Server.CreateObject(&quot;aspSmartUpload.SmartUpload&quot;)

mySmartUpload.Upload

txtFileExt = mysmartupload.files(&quot;myfilename&quot;).FileExt
txtFileName = mysmartupload.files(&quot;myfilename&quot;).FileName
txtFileName = txtFileName & &quot;.&quot; & txtFileExt
mySmartUpload.files(&quot;myfilename&quot;).saveas &quot;C:\uploads\&quot; & txtFileName
that's it.
----
TNX.
E.T.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top