elevatedmarketing
asked on
ASPSmartUpload is driving me CRAZY!
Hello all. I'm new to ASP programming and have been dealing with this for 2 weeks and need some help. I need to create a back-end user interface for a client to add articles and images AND/OR articles and MP3s to his site. Our hosting company supposedly has ASPSmartUpload installed (at least they say they do!). I have struggled for 2 weeks to try to use it to no avail. I know you are going to point me to their documentation at www.aspsmart.com --believe me, I've been there hundreds to times trying to figure this thing out and cannot. Is there a "step-by-step" tutorial or guide out there to use ASPSmartUpload? I know the problem is on my end, but I need help badly!
Sincerely,
Adam
Sincerely,
Adam
ASKER
I've tried it, I get an HTTP 500 Server Error.
Okay good!
Please try doing this:
In IE:
Tools Menu --> Internet Options -->Advanced Tab-->Show Friendly HTTP Error Messages
The last item should be unchecked.
Try that and then re run your page.
FtB
Please try doing this:
In IE:
Tools Menu --> Internet Options -->Advanced Tab-->Show Friendly HTTP Error Messages
The last item should be unchecked.
Try that and then re run your page.
FtB
ASKER
THis is what I get back...
aspSmartUpload.File error '80040460'
Unable to save file (Error 1120)
/asp/upload.asp, line 31
Here is Line 31:
file.SaveAs(filename)
By the way, I already feel like we're getting somewhere...
aspSmartUpload.File error '80040460'
Unable to save file (Error 1120)
/asp/upload.asp, line 31
Here is Line 31:
file.SaveAs(filename)
By the way, I already feel like we're getting somewhere...
That's good!
Would you please post the whole page of code so that I can take a look? Also, are you certain that you set the form type to multipart/form-data like this:
<FORM METHOD="POST" ACTION="upload.asp" ENCTYPE="multipart/form-da ta">
Would you please post the whole page of code so that I can take a look? Also, are you certain that you set the form type to multipart/form-data like this:
<FORM METHOD="POST" ACTION="upload.asp" ENCTYPE="multipart/form-da
ASKER
I know this is cheesy, but I copied the code from the page you suggested. I'm the copy and paste king... But here's my code.
************************** ********** *
<%
'Uncomment ONLY after debugging is complete
'on error resume next
Dim mySmartUpload 'declare the component
Dim intCount ' counter for the number of uploaded files
Dim File 'declare the file to upload
Dim filename 'Temp filename
Dim nextPage 'Next Page to forward to
intCount=0 'initialize the counter
'component creation
Set mySmartUpload= Server.CreateObject("aspSm artUpload. SmartUploa d")
'limit the file size to 50 Kb, Larger size not recommended
mySmartUpload.MaxFileSize = 50000
' limit the file extensions to pictures files
mySmartUpload.allowedFiles List="gif, jpg"
'Select files on the user computer
mySmartUpload.Upload
' checking all the files
For each file in mySmartUpload.Files
If not File.IsMissing then
' Add a session number to the file name
filename="../upload/" &session.sessionID & "_" & file.FileName
file.SaveAs(filename)
intCount = intCount + 1
End If
Next
' initialize the object
Set mySmartUpload=nothing
' error managment
If Err.Number = 0 then
nextPage = "asplook.asp?file=" & filename & ""
Else
nextPage = "asplook.asp?msg=An error as occured. Try again"
End if
' redirect to the result display
Response.redirect nextPage
%>
************************** **********
Thanks for your help so far!
Adam
**************************
<%
'Uncomment ONLY after debugging is complete
'on error resume next
Dim mySmartUpload 'declare the component
Dim intCount ' counter for the number of uploaded files
Dim File 'declare the file to upload
Dim filename 'Temp filename
Dim nextPage 'Next Page to forward to
intCount=0 'initialize the counter
'component creation
Set mySmartUpload= Server.CreateObject("aspSm
'limit the file size to 50 Kb, Larger size not recommended
mySmartUpload.MaxFileSize = 50000
' limit the file extensions to pictures files
mySmartUpload.allowedFiles
'Select files on the user computer
mySmartUpload.Upload
' checking all the files
For each file in mySmartUpload.Files
If not File.IsMissing then
' Add a session number to the file name
filename="../upload/" &session.sessionID & "_" & file.FileName
file.SaveAs(filename)
intCount = intCount + 1
End If
Next
' initialize the object
Set mySmartUpload=nothing
' error managment
If Err.Number = 0 then
nextPage = "asplook.asp?file=" & filename & ""
Else
nextPage = "asplook.asp?msg=An error as occured. Try again"
End if
' redirect to the result display
Response.redirect nextPage
%>
**************************
Thanks for your help so far!
Adam
Okay, the good news is that if you got as far as line 31, then the Upload component is installed.
What happens if you change this line:
filename="../upload/" &session.sessionID & "_" & file.FileName
to this:
filename= session.sessionID & "_" & file.FileName
FtB
What happens if you change this line:
filename="../upload/" &session.sessionID & "_" & file.FileName
to this:
filename= session.sessionID & "_" & file.FileName
FtB
ASKER
Glad to know ASPSmartUpload's installed...
Make the suggested change and still the same error message, same line.
Adam
Make the suggested change and still the same error message, same line.
Adam
Sounds like permissions problem! Do you (IUSR account) have permission to write to that directory?
Okay, let's comment the line out altogether, like this with an apostrophe at the start of the line:
'filename="../upload/" &session.sessionID & "_" & file.FileName
FtB
'filename="../upload/" &session.sessionID & "_" & file.FileName
FtB
ASKER
which directory should I modify in my hosting control panel? the whole thing?
@alorentz--
It is pointing to the root directory right now.
FtB
It is pointing to the root directory right now.
FtB
ASKER
OK. Making progress...
Now the Error is:
aspSmartUpload.File error '80040474'
The destination must be specified (Error 1140)
/asp/upload.asp, line 31
__________________________ _____
Also, just so you know, line 31 is the following line:
file.SaveAs(filename)
NOT
filename="../upload/" &session.sessionID & "_" & file.FileName
Now the Error is:
aspSmartUpload.File error '80040474'
The destination must be specified (Error 1140)
/asp/upload.asp, line 31
__________________________
Also, just so you know, line 31 is the following line:
file.SaveAs(filename)
NOT
filename="../upload/" &session.sessionID & "_" & file.FileName
Maybe no permissions to add files at all anywhere...? Have to talk to Host about that.
Sorry, I am being a bozo!!
Let's not comment out the line, but make it like this:
filename= file.FileName
FtB
Let's not comment out the line, but make it like this:
filename= file.FileName
FtB
ASKER
Same error message...
aspSmartUpload.File error '80040460'
Unable to save file (Error 1120)
/asp/upload.asp, line 31
aspSmartUpload.File error '80040460'
Unable to save file (Error 1120)
/asp/upload.asp, line 31
According to this:
http://www.aspsmart.com/scripts/aspSmartUpload/publigen/content/templates/show.asp?P=267&L=EN
it may indeed be a permissions issue like alorentz suggested.
In order for this to work, the IUSR_ and IWAM_ accounts must have READ/WRITE permissions to the directory.
If you don't know how to do this yourself, or do not have the means to do this, contact your hosting company and tell them what is needed.
See also:
http://p2p.wrox.com/topic.asp?TOPIC_ID=13417
FtB
http://www.aspsmart.com/scripts/aspSmartUpload/publigen/content/templates/show.asp?P=267&L=EN
it may indeed be a permissions issue like alorentz suggested.
In order for this to work, the IUSR_ and IWAM_ accounts must have READ/WRITE permissions to the directory.
If you don't know how to do this yourself, or do not have the means to do this, contact your hosting company and tell them what is needed.
See also:
http://p2p.wrox.com/topic.asp?TOPIC_ID=13417
FtB
One other thing to try in case this is a path issue:
filename= Server.MapPath(".\") & file.FileName
filename= Server.MapPath(".\") & file.FileName
ASKER
OK. That did something because this is the message I'm getting now...
aspSmartUpload.File error '80040451'
Size exceeded for this file : '\cross.jpg' (Error 1105)
/asp/upload.asp, line 23
aspSmartUpload.File error '80040451'
Size exceeded for this file : '\cross.jpg' (Error 1105)
/asp/upload.asp, line 23
Oh, that is very good news!
That means that the file is too big!
Please try a small file, and if that works, I'll show you how to increase the allowed size.
FtB
That means that the file is too big!
Please try a small file, and if that works, I'll show you how to increase the allowed size.
FtB
These lines limit the upload to 50k:
'limit the file size to 50 Kb, Larger size not recommended
mySmartUpload.MaxFileSize = 50000
To change that, just adjust the number to something higher:
'limit the file size to 50 Kb, Larger size not recommended
mySmartUpload.MaxFileSize = 250000
FtB
'limit the file size to 50 Kb, Larger size not recommended
mySmartUpload.MaxFileSize = 50000
To change that, just adjust the number to something higher:
'limit the file size to 50 Kb, Larger size not recommended
mySmartUpload.MaxFileSize = 250000
FtB
If you haven't seen it already:
http://www.aspsmart.com/aspSmartUpload/
http://www.aspsmart.com/scripts/aspSmartUpload/publigen/content/templates/show.asp?P=258&L=EN
http://www.aspsmart.com/aspSmartUpload/
http://www.aspsmart.com/scripts/aspSmartUpload/publigen/content/templates/show.asp?P=258&L=EN
Okay, so I have provided a step by step sample as requested, figured out why the code was crashing (it was a path issue) and then provided a fix for that. Unless I am mistaken, once you change the file size property, that should remove your final error.
Fritz the Blank
Fritz the Blank
ASKER
Fritz, I don't know what has happened, but it's reverted back to the old Error. I've redone what we just went through and now I can't get that one error about file size back. Here's the code I have now. Please advise and the points are yours! (I kindof feel like Santa Claus!)
**************************
<%
'Uncomment ONLY after debugging is complete
'on error resume next
Dim mySmartUpload 'declare the component
Dim intCount ' counter for the number of uploaded files
Dim File 'declare the file to upload
Dim filename 'Temp filename
Dim nextPage 'Next Page to forward to
intCount=0 'initialize the counter
'component creation
Set mySmartUpload= Server.CreateObject("aspSm artUpload. SmartUploa d")
'limit the file size to 50 Kb, Larger size not recommended
mySmartUpload.MaxFileSize = 50000
' limit the file extensions to pictures files
mySmartUpload.allowedFiles List="gif, jpg"
'Select files on the user computer
mySmartUpload.Upload
' checking all the files
For each file in mySmartUpload.Files
If not File.IsMissing then
' Add a session number to the file name
filename= Server.MapPath(".\") & file.FileName
file.SaveAs(filename)
intCount = intCount + 1
End If
Next
' initialize the object
Set mySmartUpload=nothing
' error managment
If Err.Number = 0 then
nextPage = "asplook.asp?file=" & filename & ""
Else
nextPage = "asplook.asp?msg=An error as occured. Try again"
End if
' redirect to the result display
Response.redirect nextPage
%>
************************** ******
Did I miss something?
**************************
<%
'Uncomment ONLY after debugging is complete
'on error resume next
Dim mySmartUpload 'declare the component
Dim intCount ' counter for the number of uploaded files
Dim File 'declare the file to upload
Dim filename 'Temp filename
Dim nextPage 'Next Page to forward to
intCount=0 'initialize the counter
'component creation
Set mySmartUpload= Server.CreateObject("aspSm
'limit the file size to 50 Kb, Larger size not recommended
mySmartUpload.MaxFileSize = 50000
' limit the file extensions to pictures files
mySmartUpload.allowedFiles
'Select files on the user computer
mySmartUpload.Upload
' checking all the files
For each file in mySmartUpload.Files
If not File.IsMissing then
' Add a session number to the file name
filename= Server.MapPath(".\") & file.FileName
file.SaveAs(filename)
intCount = intCount + 1
End If
Next
' initialize the object
Set mySmartUpload=nothing
' error managment
If Err.Number = 0 then
nextPage = "asplook.asp?file=" & filename & ""
Else
nextPage = "asplook.asp?msg=An error as occured. Try again"
End if
' redirect to the result display
Response.redirect nextPage
%>
**************************
Did I miss something?
What is the error and line number? Also, what size of file were you uploading?
FtB
FtB
ASKER
THe Error is:
aspSmartUpload.File error '80040460'
Unable to save file (Error 1120)
/asp/upload.asp, line 31
The file is 4.07 Kb.
aspSmartUpload.File error '80040460'
Unable to save file (Error 1120)
/asp/upload.asp, line 31
The file is 4.07 Kb.
ASKER
But also, when I try to upload a file too big, I get this (I've not changed the ASP page):
aspSmartUpload.File error '80040451'
Size exceeded for this file : '\cross.jpg' (Error 1105)
/asp/upload.asp, line 23
aspSmartUpload.File error '80040451'
Size exceeded for this file : '\cross.jpg' (Error 1105)
/asp/upload.asp, line 23
Okay, try this:
For each file in mySmartUpload.Files
If not File.IsMissing then
' Add a session number to the file name
filename= Server.MapPath(".\") & file.FileName
response.write(finename & "<P>")
response.end
file.SaveAs(filename)
intCount = intCount + 1
End If
Next
For each file in mySmartUpload.Files
If not File.IsMissing then
' Add a session number to the file name
filename= Server.MapPath(".\") & file.FileName
response.write(finename & "<P>")
response.end
file.SaveAs(filename)
intCount = intCount + 1
End If
Next
ASKER
OK. That did something. No error page now, but it just went to a blank screen. Plus I looked on my site and the file is not on my server.
Sorry,I had a typo there. That should be:
For each file in mySmartUpload.Files
If not File.IsMissing then
' Add a session number to the file name
filename= Server.MapPath(".\") & file.FileName
response.write(filename & "<P>")
response.end
file.SaveAs(filename)
intCount = intCount + 1
End If
Next
For each file in mySmartUpload.Files
If not File.IsMissing then
' Add a session number to the file name
filename= Server.MapPath(".\") & file.FileName
response.write(filename & "<P>")
response.end
file.SaveAs(filename)
intCount = intCount + 1
End If
Next
ASKER
OK. Now this is what I got:
C:\Accounts\elevated\wwwRo ot\aspalas kabike.jpg
Looked on my server and nothing there.
I feel we're right on the verge of something great here!
C:\Accounts\elevated\wwwRo
Looked on my server and nothing there.
I feel we're right on the verge of something great here!
Okay, that looks about right. Next modification:
For each file in mySmartUpload.Files
If not File.IsMissing then
' Add a session number to the file name
filename= Server.MapPath(".\") & session.sessionID &"_" & file.FileName
response.write(filename & "<P>")
response.end
file.SaveAs(filename)
intCount = intCount + 1
End If
Next
For each file in mySmartUpload.Files
If not File.IsMissing then
' Add a session number to the file name
filename= Server.MapPath(".\") & session.sessionID &"_" & file.FileName
response.write(filename & "<P>")
response.end
file.SaveAs(filename)
intCount = intCount + 1
End If
Next
ASKER
OK. Now I got:
C:\Accounts\elevated\wwwRo ot\asp1035 689867_ala skabike.jp g
C:\Accounts\elevated\wwwRo
Okay, one last stop:
<%
'Uncomment ONLY after debugging is complete
'on error resume next
Dim mySmartUpload 'declare the component
Dim intCount ' counter for the number of uploaded files
Dim File 'declare the file to upload
Dim filename 'Temp filename
Dim nextPage 'Next Page to forward to
intCount=0 'initialize the counter
'component creation
Set mySmartUpload= Server.CreateObject("aspSm artUpload. SmartUploa d")
'limit the file size to 50 Kb, Larger size not recommended
mySmartUpload.MaxFileSize = 250000
' limit the file extensions to pictures files
mySmartUpload.allowedFiles List="gif, jpg"
'Select files on the user computer
mySmartUpload.Upload
' checking all the files
For each file in mySmartUpload.Files
If not File.IsMissing then
' Add a session number to the file name
filename= Server.MapPath(".\") & session.sessionID & "_" & file.FileName
file.SaveAs(filename)
intCount = intCount + 1
End If
Next
' initialize the object
Set mySmartUpload=nothing
' error managment
If Err.Number = 0 then
nextPage = "asplook.asp?file=" & filename & ""
Else
nextPage = "asplook.asp?msg=An error as occured. Try again"
End if
' redirect to the result display
Response.redirect nextPage
%>
<%
'Uncomment ONLY after debugging is complete
'on error resume next
Dim mySmartUpload 'declare the component
Dim intCount ' counter for the number of uploaded files
Dim File 'declare the file to upload
Dim filename 'Temp filename
Dim nextPage 'Next Page to forward to
intCount=0 'initialize the counter
'component creation
Set mySmartUpload= Server.CreateObject("aspSm
'limit the file size to 50 Kb, Larger size not recommended
mySmartUpload.MaxFileSize = 250000
' limit the file extensions to pictures files
mySmartUpload.allowedFiles
'Select files on the user computer
mySmartUpload.Upload
' checking all the files
For each file in mySmartUpload.Files
If not File.IsMissing then
' Add a session number to the file name
filename= Server.MapPath(".\") & session.sessionID & "_" & file.FileName
file.SaveAs(filename)
intCount = intCount + 1
End If
Next
' initialize the object
Set mySmartUpload=nothing
' error managment
If Err.Number = 0 then
nextPage = "asplook.asp?file=" & filename & ""
Else
nextPage = "asplook.asp?msg=An error as occured. Try again"
End if
' redirect to the result display
Response.redirect nextPage
%>
ASKER
Back to the old error message:
aspSmartUpload.File error '80040460'
Unable to save file (Error 1120)
/asp/upload.asp, line 29
For clarification, I just cut and pasted your last code as my asp page. That was right, right?
aspSmartUpload.File error '80040460'
Unable to save file (Error 1120)
/asp/upload.asp, line 29
For clarification, I just cut and pasted your last code as my asp page. That was right, right?
You have done everything correctly.
The whole point of the last few posts was to ensure that you had a proper path specified, that the name of the file was making it, that it had a unique name and etc. and etc. These tests show that everything is as it should be.
This definitely appears to be a permissions issue, so you will have to follow up with your hosting service. Explain to them that the IUSR_ and IWAM_ accounts need to have Read/Write permissions to this directory.
FtB
The whole point of the last few posts was to ensure that you had a proper path specified, that the name of the file was making it, that it had a unique name and etc. and etc. These tests show that everything is as it should be.
This definitely appears to be a permissions issue, so you will have to follow up with your hosting service. Explain to them that the IUSR_ and IWAM_ accounts need to have Read/Write permissions to this directory.
FtB
ASKER
I've submitted the ticket to them and I'll get back to you ASAP. Thanks for all your help! I look forward to giving you those points.
Should I revert back to the previous version of the ASP page for is the whole page post you posted 3 posts ok to serve as my code?
Should I revert back to the previous version of the ASP page for is the whole page post you posted 3 posts ok to serve as my code?
Please stay with the most recent version. The tests that we performed above show that everything is as it should be.
FtB
FtB
ASKER
I'm on with TS at my hosting company. Hope to get this resolved ASAP.
Adam
Adam
ASKER
OK. TS was able to isolate the issue and get it fixed. This is the final ASP Upload code that works:
__________________________ __________ ____
<%
'Uncomment ONLY after debugging is complete
'on error resume next
Dim mySmartUpload 'declare the component
Dim intCount ' counter for the number of uploaded files
Dim File 'declare the file to upload
Dim filename 'Temp filename
Dim nextPage 'Next Page to forward to
intCount=0 'initialize the counter
'component creation
Set mySmartUpload= Server.CreateObject("aspSm artUpload. SmartUploa d")
'limit the file size to 50 Kb, Larger size not recommended
mySmartUpload.MaxFileSize = 250000
' limit the file extensions to pictures files
mySmartUpload.allowedFiles List="gif, jpg"
'Select files on the user computer
mySmartUpload.Upload
' checking all the files
For each file in mySmartUpload.Files
If not File.IsMissing then
' Add a session number to the file name
filename= Server.MapPath(".\") & "\" & file.FileName
file.SaveAs(filename)
intCount = intCount + 1
End If
Next
' initialize the object
Set mySmartUpload=nothing
' error managment
If Err.Number = 0 then
nextPage = "asplook.asp?file=" & filename & ""
Else
nextPage = "asplook.asp?msg=An error as occured. Try again"
End if
' redirect to the result display
Response.redirect nextPage
%>
__________________________ __________ __________ _________
Now 2 things:
1. the files are being uploaded to the rootdirectory and not my directory called "uploads". How do I change that?
2. on the following page "asplook.asp" the image will not display. Here's the code:
_________________________
<HTML>
<BODY BGCOLOR="white">
<%
if IsEmpty(request.querystrin g("msg")) then
%>
<img src="<%=request.querystrin g("file")% >">
<%
else
%>
<%=request.querystring("ms g")%>
<%
end if
%>
</BODY>
</HTML>
__________________________ __________ _
Thanks!
__________________________
<%
'Uncomment ONLY after debugging is complete
'on error resume next
Dim mySmartUpload 'declare the component
Dim intCount ' counter for the number of uploaded files
Dim File 'declare the file to upload
Dim filename 'Temp filename
Dim nextPage 'Next Page to forward to
intCount=0 'initialize the counter
'component creation
Set mySmartUpload= Server.CreateObject("aspSm
'limit the file size to 50 Kb, Larger size not recommended
mySmartUpload.MaxFileSize = 250000
' limit the file extensions to pictures files
mySmartUpload.allowedFiles
'Select files on the user computer
mySmartUpload.Upload
' checking all the files
For each file in mySmartUpload.Files
If not File.IsMissing then
' Add a session number to the file name
filename= Server.MapPath(".\") & "\" & file.FileName
file.SaveAs(filename)
intCount = intCount + 1
End If
Next
' initialize the object
Set mySmartUpload=nothing
' error managment
If Err.Number = 0 then
nextPage = "asplook.asp?file=" & filename & ""
Else
nextPage = "asplook.asp?msg=An error as occured. Try again"
End if
' redirect to the result display
Response.redirect nextPage
%>
__________________________
Now 2 things:
1. the files are being uploaded to the rootdirectory and not my directory called "uploads". How do I change that?
2. on the following page "asplook.asp" the image will not display. Here's the code:
_________________________
<HTML>
<BODY BGCOLOR="white">
<%
if IsEmpty(request.querystrin
%>
<img src="<%=request.querystrin
<%
else
%>
<%=request.querystring("ms
<%
end if
%>
</BODY>
</HTML>
__________________________
Thanks!
See told ya it was permissions :)
Good luck!
Good luck!
I am not sure that I see what the difference is. Did they say it was a permissions issue or did they change anything in the code?
About your remaining questions:
1) Do you actually have a directory named uploads in your web root?
2) there is no image tag here: <%=request.querystring("ms g")%>
FtB
About your remaining questions:
1) Do you actually have a directory named uploads in your web root?
2) there is no image tag here: <%=request.querystring("ms
FtB
If you are sure that you have a directory named uploads off of your root, then just do:
filename= Server.MapPath(".\") & "\Uploads\" & file.FileName
FtB
filename= Server.MapPath(".\") & "\Uploads\" & file.FileName
FtB
If you need assistance closing this question, please let me know...thanks.
ASKER
Well, the did change the code a bit in the Server Map Path--but that may have been a smoke screen for not being able to change the permissions as quickly as they should have...
I do have a directory named uploads. I made the suggested changes, putting in the "\uploads\" command, but still get the same error as eariler.
What I'm also wanting it to do is return the http: address where that image just uploaded can be found, and also the image that was just uploaded.
I do have a directory named uploads. I made the suggested changes, putting in the "\uploads\" command, but still get the same error as eariler.
What I'm also wanting it to do is return the http: address where that image just uploaded can be found, and also the image that was just uploaded.
Okay, we need to stay focused and deal with the most pressing issue at hand. If you have a series of other questions, perhaps you can post them in separate threads.
This is what I had:
filename= Server.MapPath(".\") & session.sessionID & "_" & file.FileName
This is in your new code:
filename= Server.MapPath(".\") & "\" & file.FileName
The difference here is that what I have will uniquely name each file. That way, if two users try to upload a file with the same name, one won't overwrite the other.
Now, you are telling me that you have a directory named uploads? As a test, put an image in that directory, and then tell me what you have to put in the URL to see it.
FtB
This is what I had:
filename= Server.MapPath(".\") & session.sessionID & "_" & file.FileName
This is in your new code:
filename= Server.MapPath(".\") & "\" & file.FileName
The difference here is that what I have will uniquely name each file. That way, if two users try to upload a file with the same name, one won't overwrite the other.
Now, you are telling me that you have a directory named uploads? As a test, put an image in that directory, and then tell me what you have to put in the URL to see it.
FtB
ASKER
http://www.elevatedmarketing.com/asp/uploads/naples.jpg (this is where I want the files to be uploaded to and have this same link returned for later entry into a database.
I'm not worried about other users uploading same-named files because there are only two users and once the file is uploaded, it will be done and not need to be revisited.
I'm not worried about other users uploading same-named files because there are only two users and once the file is uploaded, it will be done and not need to be revisited.
Okay, if your page is in the root directory, then maybe instead of this:
filename= Server.MapPath(".\") & "\" & file.FileName
you need this:
filename= Server.MapPath(".\") & "\asp\uploads\" & file.FileName
FtB
filename= Server.MapPath(".\") & "\" & file.FileName
you need this:
filename= Server.MapPath(".\") & "\asp\uploads\" & file.FileName
FtB
ASKER
Back to the same old error:
aspSmartUpload.File error '80040460'
Unable to save file (Error 1120)
/asp/upload.asp, line 29
It was uploading fine right before we did that just now. It's currently uploading them to the root directory.
aspSmartUpload.File error '80040460'
Unable to save file (Error 1120)
/asp/upload.asp, line 29
It was uploading fine right before we did that just now. It's currently uploading them to the root directory.
Is your upload page in the root directory or in the asp directory?
FtB
FtB
ASKER
asp directory
Okay, then I think that this should be it:
filename= Server.MapPath(".\") & "\uploads\" & file.FileName
FtB
filename= Server.MapPath(".\") & "\uploads\" & file.FileName
FtB
If not, then we will troubleshoot further.
FtB
FtB
ASKER
Didn't work. Same error.
Okay, here we go again.
<%
'Uncomment ONLY after debugging is complete
'on error resume next
Dim mySmartUpload 'declare the component
Dim intCount ' counter for the number of uploaded files
Dim File 'declare the file to upload
Dim filename 'Temp filename
Dim nextPage 'Next Page to forward to
intCount=0 'initialize the counter
'component creation
Set mySmartUpload= Server.CreateObject("aspSm artUpload. SmartUploa d")
'limit the file size to 50 Kb, Larger size not recommended
mySmartUpload.MaxFileSize = 250000
' limit the file extensions to pictures files
mySmartUpload.allowedFiles List="gif, jpg"
'Select files on the user computer
mySmartUpload.Upload
' checking all the files
For each file in mySmartUpload.Files
If not File.IsMissing then
' Add a session number to the file name
response.write(Server.MapP ath(".\") & "\" & file.FileName)
response.end
filename= Server.MapPath(".\") & "\" & file.FileName
file.SaveAs(filename)
intCount = intCount + 1
End If
Next
' initialize the object
Set mySmartUpload=nothing
' error managment
If Err.Number = 0 then
nextPage = "asplook.asp?file=" & filename & ""
Else
nextPage = "asplook.asp?msg=An error as occured. Try again"
End if
' redirect to the result display
Response.redirect nextPage
%>
<%
'Uncomment ONLY after debugging is complete
'on error resume next
Dim mySmartUpload 'declare the component
Dim intCount ' counter for the number of uploaded files
Dim File 'declare the file to upload
Dim filename 'Temp filename
Dim nextPage 'Next Page to forward to
intCount=0 'initialize the counter
'component creation
Set mySmartUpload= Server.CreateObject("aspSm
'limit the file size to 50 Kb, Larger size not recommended
mySmartUpload.MaxFileSize = 250000
' limit the file extensions to pictures files
mySmartUpload.allowedFiles
'Select files on the user computer
mySmartUpload.Upload
' checking all the files
For each file in mySmartUpload.Files
If not File.IsMissing then
' Add a session number to the file name
response.write(Server.MapP
response.end
filename= Server.MapPath(".\") & "\" & file.FileName
file.SaveAs(filename)
intCount = intCount + 1
End If
Next
' initialize the object
Set mySmartUpload=nothing
' error managment
If Err.Number = 0 then
nextPage = "asplook.asp?file=" & filename & ""
Else
nextPage = "asplook.asp?msg=An error as occured. Try again"
End if
' redirect to the result display
Response.redirect nextPage
%>
ASKER
now it's returning this after the "upload"
C:\Accounts\elevated\wwwRo ot\asp\AA0 48570.JPG
BUT it's not actually uploading them to the server.
C:\Accounts\elevated\wwwRo
BUT it's not actually uploading them to the server.
Please understand, this is not to upload but to troubleshoot--the part of the code that does the uploading will never execute because of the response.end. Doing what we are doing here allows us to see what is going on; think about this for a minute--I don't know your directory structure and I can't test!!!!!
Okay, back to this.
This path does not look good:
C:\Accounts\elevated\wwwRo ot\asp\AA0 48570.JPG
It is missing the Upload directory. Let's try:
<%
'Uncomment ONLY after debugging is complete
'on error resume next
Dim mySmartUpload 'declare the component
Dim intCount ' counter for the number of uploaded files
Dim File 'declare the file to upload
Dim filename 'Temp filename
Dim nextPage 'Next Page to forward to
intCount=0 'initialize the counter
'component creation
Set mySmartUpload= Server.CreateObject("aspSm artUpload. SmartUploa d")
'limit the file size to 50 Kb, Larger size not recommended
mySmartUpload.MaxFileSize = 250000
' limit the file extensions to pictures files
mySmartUpload.allowedFiles List="gif, jpg"
'Select files on the user computer
mySmartUpload.Upload
' checking all the files
For each file in mySmartUpload.Files
If not File.IsMissing then
' Add a session number to the file name
response.write(Server.MapP ath(".\") & "\uploads\" & file.FileName)
response.end
filename= Server.MapPath(".\") & "\uploads\" & file.FileName
file.SaveAs(filename)
intCount = intCount + 1
End If
Next
' initialize the object
Set mySmartUpload=nothing
' error managment
If Err.Number = 0 then
nextPage = "asplook.asp?file=" & filename & ""
Else
nextPage = "asplook.asp?msg=An error as occured. Try again"
End if
' redirect to the result display
Response.redirect nextPage
%>
Okay, back to this.
This path does not look good:
C:\Accounts\elevated\wwwRo
It is missing the Upload directory. Let's try:
<%
'Uncomment ONLY after debugging is complete
'on error resume next
Dim mySmartUpload 'declare the component
Dim intCount ' counter for the number of uploaded files
Dim File 'declare the file to upload
Dim filename 'Temp filename
Dim nextPage 'Next Page to forward to
intCount=0 'initialize the counter
'component creation
Set mySmartUpload= Server.CreateObject("aspSm
'limit the file size to 50 Kb, Larger size not recommended
mySmartUpload.MaxFileSize = 250000
' limit the file extensions to pictures files
mySmartUpload.allowedFiles
'Select files on the user computer
mySmartUpload.Upload
' checking all the files
For each file in mySmartUpload.Files
If not File.IsMissing then
' Add a session number to the file name
response.write(Server.MapP
response.end
filename= Server.MapPath(".\") & "\uploads\" & file.FileName
file.SaveAs(filename)
intCount = intCount + 1
End If
Next
' initialize the object
Set mySmartUpload=nothing
' error managment
If Err.Number = 0 then
nextPage = "asplook.asp?file=" & filename & ""
Else
nextPage = "asplook.asp?msg=An error as occured. Try again"
End if
' redirect to the result display
Response.redirect nextPage
%>
ASKER
Now it returns:
C:\Accounts\elevated\wwwRo ot\asp\upl oads\bible .jpg
And sorry for jumping the gun... You are definitely the man!
C:\Accounts\elevated\wwwRo
And sorry for jumping the gun... You are definitely the man!
>>You are definitely the man!
I thought I was the man? ;)
I thought I was the man? ;)
ASKER
alorentz--you're really jockeying for these points?
haha
haha
Okay, so this looks exactly as it should, so theoretically, the code below should work. If it does not, then it is time to speak to your hosting folks again:
<%
'Uncomment ONLY after debugging is complete
'on error resume next
Dim mySmartUpload 'declare the component
Dim intCount ' counter for the number of uploaded files
Dim File 'declare the file to upload
Dim filename 'Temp filename
Dim nextPage 'Next Page to forward to
intCount=0 'initialize the counter
'component creation
Set mySmartUpload= Server.CreateObject("aspSm artUpload. SmartUploa d")
'limit the file size to 50 Kb, Larger size not recommended
mySmartUpload.MaxFileSize = 250000
' limit the file extensions to pictures files
mySmartUpload.allowedFiles List="gif, jpg"
'Select files on the user computer
mySmartUpload.Upload
' checking all the files
For each file in mySmartUpload.Files
If not File.IsMissing then
' Add a session number to the file name
filename= Server.MapPath(".\") & "\uploads\" & file.FileName
file.SaveAs(filename)
intCount = intCount + 1
End If
Next
' initialize the object
Set mySmartUpload=nothing
' error managment
If Err.Number = 0 then
nextPage = "asplook.asp?file=" & filename & ""
Else
nextPage = "asplook.asp?msg=An error as occured. Try again"
End if
' redirect to the result display
Response.redirect nextPage
%>
<%
'Uncomment ONLY after debugging is complete
'on error resume next
Dim mySmartUpload 'declare the component
Dim intCount ' counter for the number of uploaded files
Dim File 'declare the file to upload
Dim filename 'Temp filename
Dim nextPage 'Next Page to forward to
intCount=0 'initialize the counter
'component creation
Set mySmartUpload= Server.CreateObject("aspSm
'limit the file size to 50 Kb, Larger size not recommended
mySmartUpload.MaxFileSize = 250000
' limit the file extensions to pictures files
mySmartUpload.allowedFiles
'Select files on the user computer
mySmartUpload.Upload
' checking all the files
For each file in mySmartUpload.Files
If not File.IsMissing then
' Add a session number to the file name
filename= Server.MapPath(".\") & "\uploads\" & file.FileName
file.SaveAs(filename)
intCount = intCount + 1
End If
Next
' initialize the object
Set mySmartUpload=nothing
' error managment
If Err.Number = 0 then
nextPage = "asplook.asp?file=" & filename & ""
Else
nextPage = "asplook.asp?msg=An error as occured. Try again"
End if
' redirect to the result display
Response.redirect nextPage
%>
ASKER
Brilliant! It works!!! It's in the correct directory and everything!
Now the only thing is the following asplook.asp page doesn't display the image. It's coded exactly like the example you sent to me in the first response.
Now the only thing is the following asplook.asp page doesn't display the image. It's coded exactly like the example you sent to me in the first response.
Okay, this should be a different thread, but let's see what we can do here...
FtB
FtB
ASKER
Do you want me to start a new thread? I'll be glad to.
Let's try this:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
</HEAD>
<BODY BGCOLOR="white">
<img src="<%=request.querystrin g("file")% >">
</BODY>
</HTML>
FtB
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
</HEAD>
<BODY BGCOLOR="white">
<img src="<%=request.querystrin
</BODY>
</HTML>
FtB
>>alorentz--you're really jockeying for these points?
Well, if it was permissions problem, then yes... If not, then no! Giddee-up!
Well, if it was permissions problem, then yes... If not, then no! Giddee-up!
ASKER
alorentz--I'm not sure it was a permissions issue. according to my hosting company, they said it wasn't--it was coding. And I just don't know. So I'm in a quandry here.
So, did the last code sample display your image?
FtB
FtB
ASKER
Nothing. Just the image icon with a red X on it.
Okay, now if you right click on the image and choose properties, what do you see?
FtB
FtB
ASKER
the URL listed is:
file:///C:/Accounts/elevat ed/wwwRoot /asp/uploa ds/bible2. jpg
file:///C:/Accounts/elevat
Okay, I see the problem now and am thinking of the best way to fix this....
FtB
FtB
<%
'Uncomment ONLY after debugging is complete
'on error resume next
Dim mySmartUpload 'declare the component
Dim intCount ' counter for the number of uploaded files
Dim File 'declare the file to upload
Dim filename 'Temp filename
Dim nextPage 'Next Page to forward to
intCount=0 'initialize the counter
'component creation
Set mySmartUpload= Server.CreateObject("aspSm artUpload. SmartUploa d")
'limit the file size to 50 Kb, Larger size not recommended
mySmartUpload.MaxFileSize = 250000
' limit the file extensions to pictures files
mySmartUpload.allowedFiles List="gif, jpg"
'Select files on the user computer
mySmartUpload.Upload
' checking all the files
For each file in mySmartUpload.Files
If not File.IsMissing then
' Add a session number to the file name
fileView = file.FileName
filename= Server.MapPath(".\") & "\uploads\" & file.FileName
file.SaveAs(filename)
intCount = intCount + 1
End If
Next
' initialize the object
Set mySmartUpload=nothing
' error managment
If Err.Number = 0 then
nextPage = "asplook.asp?file=" & filename & ""
Else
nextPage = "asplook.asp?msg=An error as occured. Try again"
End if
' redirect to the result display
Response.redirect nextPage
%>
And then:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
</HEAD>
<BODY BGCOLOR="white">
<img src="/Uploads/<%=request.q uerystring ("fileview ")%>">
</BODY>
</HTML>
'Uncomment ONLY after debugging is complete
'on error resume next
Dim mySmartUpload 'declare the component
Dim intCount ' counter for the number of uploaded files
Dim File 'declare the file to upload
Dim filename 'Temp filename
Dim nextPage 'Next Page to forward to
intCount=0 'initialize the counter
'component creation
Set mySmartUpload= Server.CreateObject("aspSm
'limit the file size to 50 Kb, Larger size not recommended
mySmartUpload.MaxFileSize = 250000
' limit the file extensions to pictures files
mySmartUpload.allowedFiles
'Select files on the user computer
mySmartUpload.Upload
' checking all the files
For each file in mySmartUpload.Files
If not File.IsMissing then
' Add a session number to the file name
fileView = file.FileName
filename= Server.MapPath(".\") & "\uploads\" & file.FileName
file.SaveAs(filename)
intCount = intCount + 1
End If
Next
' initialize the object
Set mySmartUpload=nothing
' error managment
If Err.Number = 0 then
nextPage = "asplook.asp?file=" & filename & ""
Else
nextPage = "asplook.asp?msg=An error as occured. Try again"
End if
' redirect to the result display
Response.redirect nextPage
%>
And then:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
</HEAD>
<BODY BGCOLOR="white">
<img src="/Uploads/<%=request.q
</BODY>
</HTML>
ASKER
Ok. Same image with the X and here's the properties:
http://www.elevatedmarketing.com/Uploads/
No filename at all.
http://www.elevatedmarketing.com/Uploads/
No filename at all.
Perhaps it is a Case issue. Please try again:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
</HEAD>
<BODY BGCOLOR="white">
<img src="/Uploads/<%=request.q uerystring ("fileView ")%>">
</BODY>
</HTML>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
</HEAD>
<BODY BGCOLOR="white">
<img src="/Uploads/<%=request.q
</BODY>
</HTML>
ASKER
Still nothing. no filename in the properties.
Are you using this code? There is an extra line added:
<%
'Uncomment ONLY after debugging is complete
'on error resume next
Dim mySmartUpload 'declare the component
Dim intCount ' counter for the number of uploaded files
Dim File 'declare the file to upload
Dim filename 'Temp filename
Dim nextPage 'Next Page to forward to
intCount=0 'initialize the counter
'component creation
Set mySmartUpload= Server.CreateObject("aspSm artUpload. SmartUploa d")
'limit the file size to 50 Kb, Larger size not recommended
mySmartUpload.MaxFileSize = 250000
' limit the file extensions to pictures files
mySmartUpload.allowedFiles List="gif, jpg"
'Select files on the user computer
mySmartUpload.Upload
' checking all the files
For each file in mySmartUpload.Files
If not File.IsMissing then
' Add a session number to the file name
fileView = file.FileName
filename= Server.MapPath(".\") & "\uploads\" & file.FileName
file.SaveAs(filename)
intCount = intCount + 1
End If
Next
' initialize the object
Set mySmartUpload=nothing
' error managment
If Err.Number = 0 then
nextPage = "asplook.asp?file=" & filename & ""
Else
nextPage = "asplook.asp?msg=An error as occured. Try again"
End if
' redirect to the result display
Response.redirect nextPage
%>
And then:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
</HEAD>
<BODY BGCOLOR="white">
<img src="/Uploads/<%=request.q uerystring ("fileview ")%>">
</BODY>
</HTML>
<%
'Uncomment ONLY after debugging is complete
'on error resume next
Dim mySmartUpload 'declare the component
Dim intCount ' counter for the number of uploaded files
Dim File 'declare the file to upload
Dim filename 'Temp filename
Dim nextPage 'Next Page to forward to
intCount=0 'initialize the counter
'component creation
Set mySmartUpload= Server.CreateObject("aspSm
'limit the file size to 50 Kb, Larger size not recommended
mySmartUpload.MaxFileSize = 250000
' limit the file extensions to pictures files
mySmartUpload.allowedFiles
'Select files on the user computer
mySmartUpload.Upload
' checking all the files
For each file in mySmartUpload.Files
If not File.IsMissing then
' Add a session number to the file name
fileView = file.FileName
filename= Server.MapPath(".\") & "\uploads\" & file.FileName
file.SaveAs(filename)
intCount = intCount + 1
End If
Next
' initialize the object
Set mySmartUpload=nothing
' error managment
If Err.Number = 0 then
nextPage = "asplook.asp?file=" & filename & ""
Else
nextPage = "asplook.asp?msg=An error as occured. Try again"
End if
' redirect to the result display
Response.redirect nextPage
%>
And then:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
</HEAD>
<BODY BGCOLOR="white">
<img src="/Uploads/<%=request.q
</BODY>
</HTML>
ASKER
<%
'Uncomment ONLY after debugging is complete
'on error resume next
Dim mySmartUpload 'declare the component
Dim intCount ' counter for the number of uploaded files
Dim File 'declare the file to upload
Dim filename 'Temp filename
Dim nextPage 'Next Page to forward to
intCount=0 'initialize the counter
'component creation
Set mySmartUpload= Server.CreateObject("aspSm artUpload. SmartUploa d")
'limit the file size to 50 Kb, Larger size not recommended
mySmartUpload.MaxFileSize = 250000
' limit the file extensions to pictures files
mySmartUpload.allowedFiles List="gif, jpg"
'Select files on the user computer
mySmartUpload.Upload
' checking all the files
For each file in mySmartUpload.Files
If not File.IsMissing then
' Add a session number to the file name
fileView = file.FileName
filename= Server.MapPath(".\") & "\uploads\" & file.FileName
file.SaveAs(filename)
intCount = intCount + 1
End If
Next
' initialize the object
Set mySmartUpload=nothing
' error managment
If Err.Number = 0 then
nextPage = "asplook.asp?file=" & filename & ""
Else
nextPage = "asplook.asp?msg=An error as occured. Try again"
End if
' redirect to the result display
Response.redirect nextPage
%>
__________________________ _
then
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
</HEAD>
<BODY BGCOLOR="white">
<img src="/Uploads/<%=request.q uerystring ("fileView ")%>">
</BODY>
</HTML>
'Uncomment ONLY after debugging is complete
'on error resume next
Dim mySmartUpload 'declare the component
Dim intCount ' counter for the number of uploaded files
Dim File 'declare the file to upload
Dim filename 'Temp filename
Dim nextPage 'Next Page to forward to
intCount=0 'initialize the counter
'component creation
Set mySmartUpload= Server.CreateObject("aspSm
'limit the file size to 50 Kb, Larger size not recommended
mySmartUpload.MaxFileSize = 250000
' limit the file extensions to pictures files
mySmartUpload.allowedFiles
'Select files on the user computer
mySmartUpload.Upload
' checking all the files
For each file in mySmartUpload.Files
If not File.IsMissing then
' Add a session number to the file name
fileView = file.FileName
filename= Server.MapPath(".\") & "\uploads\" & file.FileName
file.SaveAs(filename)
intCount = intCount + 1
End If
Next
' initialize the object
Set mySmartUpload=nothing
' error managment
If Err.Number = 0 then
nextPage = "asplook.asp?file=" & filename & ""
Else
nextPage = "asplook.asp?msg=An error as occured. Try again"
End if
' redirect to the result display
Response.redirect nextPage
%>
__________________________
then
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
</HEAD>
<BODY BGCOLOR="white">
<img src="/Uploads/<%=request.q
</BODY>
</HTML>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
YOU DID IT! YOU ARE THE MAN! It works!
I think I can hear angels singing!
THank so much for the help!
I think I can hear angels singing!
THank so much for the help!
Glad to have helped and good luck with your project.
FtB
FtB
ASKER
I really appreciate it and I'm sure I'll be back!
http://www.flarehosting.com/support/faq/faq_asp_upload.asp
FtB