| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread |
Rating:
|
Display Modes |
|
#61
|
||||
|
||||
|
I get "not found" for the whole /html folder.
http://www.chinaklang.com/html/Down/td_act_bottom.gif (not found) http://www.chinaklang.com/html (not found) |
|
#62
|
|||
|
|||
|
sorry, i've typed a wrong link, the right one is without "/html"
|
|
#63
|
||||
|
||||
|
Quote:
still no luck. getting the attached error message. looks like the problem is not with the upload code but with the image itself.... how did you build it? how can you view it? |
|
#64
|
|||
|
|||
|
i've put both of them into a zip file, hope it works.
www . chinaklang . com / Down / error.zip many thanks!!! |
|
#65
|
||||
|
||||
|
Quote:
sorry, wasn't able to reproduce your problem. I was able to view and open both the files with no problem. I then uploaded the files and tried to view and open the new files: no problem. looks like it's problem with your personal computer, consider posting in the Windows OS forum with more details. (as far as I can see, it's not related to ASP) |
|
#66
|
|||
|
|||
|
many Thanks, i'll find what's going on with my computer
|
|
#67
|
|||
|
|||
|
image to big, not saving!
Sorry i figured it out
Last edited by sam2006 : April 22nd, 2009 at 05:17 PM. Reason: SOLVED |
|
#68
|
|||
|
|||
|
can I use this to upload a file and then save the name to a hidden field within my registration form?
is that possible? |
|
#69
|
||||||
|
||||||
|
Quote:
Quote:
yes, using the code you can upload file from the client machine to the server and save that file on the server disk. Quote:
yes you can know the file name (IE give full path, Firefox only the name of the file, no full path) and with the name you can do whatever you want. Quote:
here I've lost you. what do you mean "save to hidden field"? what form? after the file was uploaded, ASP code is executed. you should put message like "file uploaded successfully" or "failed to upload". by the time the file was uploaded, there is no longer form, unless you put brand new form after the one used to upload the file. |
|
#70
|
|||
|
|||
|
I meant uploading the file without submitting the form and then updating a hidden field value on the form.
I'm trying to work on a iframe solution now. |
|
#71
|
||||
|
||||
|
Quote:
you can make it "silent" by using client side JavaScript. if you add iframe to your page you can change the form "target" attribute to the name of the frame and when submitted, it will be silent and the user will stay in the page. it's not going to be simple but it's possible. to send the file name to the parent page have such code in the ASP: Code:
Set objUpload=New ShadowUpload
If objUpload.GetError<>"" Then
Response.Write("sorry, could not upload: "&objUpload.GetError)
Else
If To objUpload.FileCount=0 Then
Response.Write("no file selected")
Else
Call objUpload.File(0).SaveToDisk(Server.MapPath("Uploads"), "")
Response.Write("<script type=""text/javascript""> parent.document.getElementById(""MyFile"").value = """ & objUpload.File(x).FileName & """; </script>")
End If
this will upload the file and send client side script for setting the text box value. for the above to work, you'll have to add id "MyFile" to the text box, of course you can have different id and change the code accordingly. |
|
#72
|
|||
|
|||
|
I really hope people still read this thread!
I've got the code working, so first of all thanks so much it was easy and works amazingly! I have a slight problem though that may or may not be curable... ive got the code sitting in a folder called 'staff' where all the site maintenance pages sit. however i want the images to be uploaded to a directory lower down in the structure, ie the code is sitting at https://www.site.com/staff/upload.asp but i want the images to go to http://www.site.com/images I don't want the images in the staff section, partly because i want them on the same level as the rest of the customer pages, but also because the directory 'staff' as a whole is set so it needs to be viewed over https, whereas the customer level of the site isnt, so really i need them to go to ../images I tired to amend the location in the code, but it says that '..' isnt allowed as a location, and i also tried the full address (ie http://www.site.com/images) but it didnt like that either. Is it possible to send the files to the lower level, non secure directory at all? |
|
#73
|
||||
|
||||
|
have you tried this?
Code:
Call objUpload.File(0).SaveToDisk(Server.MapPath("/images/"), "")
if so, what happens when you have it? |
![]() |
| Viewing: ASP Free Forums > Programming > Code Bank > Pure ASP Upload script with additional features |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|