File upload to website and rezise at the same time

W

William LaMartin

I have a VB ASP.Net application where the user can upload a file using the
FileUpload server control. I also want a thumbnail to be created for this
file. Unfortunately I can see no means to determine when the file upload is
complete so that I can use the MakeThumbnail function as part of the code.
My current workaround is to supply an addition button the users can click on
when they think the upload is done that will find the uploaded file and make
the thumbnail.

Is there a way to determine when the upload is complete?
 
P

Patrice

You shouldn't have to worry about this. I believe you have some kind of
problem making you think that the file is not uploaded yet but this is
likely not the problem you have...

What have you seen exactly ?
 
W

William LaMartin

The file gets uploaded. I just can't immediately follow the upload code
with a make
Thumbnail function since apparently the uploaded file is either not fully
loaded or listed in the file structure of the server at that time.

I think I have solved the problem, though, by adding the following code
right after the upload code.

Dim fi As New System.IO.FileInfo(Server.MapPath(".") & "\Photos\" &
FileUpload1.FileName)
Do While fi.Exists = False
'do nothing
Loop
 
P

Patrice

Still don't know what you have seen exactly. An antivirus software could
also perhaps lock the file for a short period.

IMO this is not something normal. Though it works I would still investigate
a bit further...
 
W

William LaMartin

It appears to me that VB does not wait for the FileUpload server control to
finish saving the file to the server hard drive before proceeding to execute
the next line of code. And if that next line of code requires access to the
uploaded file you run into trouble--unless you wait until you know that the
file exists, which is why checking for its existence before proceeding
appears to solve the problem.
 
P

Patrice

I still don't know what was the message you had and I would have been
interested in seeing some code. Execution is supposed to be sequential.
I'll give this a try as soon as I have 2.0 handy.
 

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

Top