File upload woes

  • Thread starter Thread starter Bill Ross
  • Start date Start date
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,
 
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...
 
Thanks, Patrice.

What about the fact that the file name disappears from the filupload control
when I do my validation using C# script?
 
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)...
 
Back
Top