File upload woes

B

Bill Ross

I am trying to do the following:

* receive three image files one at a time
* validate that it is a valid image type, size
* as each is received, I store the image, then show the image
* when all are received and validated, I email them to myself

What seems to happen is that when I run my C# script to validate and save
the file it does a post back and the FileUpload control is then blank.

Also, I try assigning the url of the saved file to my image.imageurl
property thus:

"file:///c:\mypath\myfile.jpg" but it does not show the file. It seems that
it needs an "http://" address. Is that true?

Thanks,
 
P

Patrice

Yes,

Remember that the browser runs on your computer so if you point your browser
to file:///c:\mypath\myfile.jpg it will search the file on YOUR computer not
on the server (and actually it likely even doesn't work as AFAIK by default
a web page can't reference local content any more for safety reasons).

You'll have to use the url of the file on your website...
 
B

Bill Ross

Thanks, Patrice.

What about the fact that the file name disappears from the filupload control
when I do my validation using C# script?
 
P

Patrice

The content of an input type=file is read only... Not sure what you do
exactly but for example if a postback is involved the value can't be
restored (it always has to be defined by the user for safety reasons)...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,996
Messages
2,570,238
Members
46,826
Latest member
robinsontor

Latest Threads

Top