Welcome Guest Search | Active Topics | Sign In | Register

Gettting uploaded fileName programmatically from Server Code. Options
Emran Hussain
Posted: Monday, July 7, 2008 1:48:05 AM
Rank: Newbie
Groups: Member

Joined: 7/3/2008
Posts: 9
Hello,

How can I get the list of uploaded files programatically from server side code ? The standard ASP.NET file upload control gives FileName property to get the uploaded file, but I am missing similar property from your control. Please help.

Emran
eo_support
Posted: Monday, July 7, 2008 6:33:43 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,193
Emran Hussain
Posted: Monday, July 7, 2008 3:10:55 PM
Rank: Newbie
Groups: Member

Joined: 7/3/2008
Posts: 9
Thanks for your reply. I got some more questions.

I have assigned "~/temp" to be my temporary upload folder and "~/uploaded" to be my final folder.

Now, After I upload a file, I see that, *********.info and *********.status files are not removed from the temp folder. I was thinking that it should have been done automatically by the control but anyway, I tried to write code for deleting those files. But I dont understand how can I get exactly the ******.info and *****.status file names created by the same instance of the control ? Because, if I simply delete all files in the "~/temp" folder after the upload, may be another user uploading a file will experience that the data is lost.

So, please suggest me the correct step for clearing my temp folder.

Regards/
eo_support
Posted: Monday, July 7, 2008 3:21:10 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,193
Hi,

You do not need to worry about those files. They will be automatically deleted eventually. The uploader does not automatically delete them right away because your code may still use it.

Thanks
Emran Hussain
Posted: Monday, July 7, 2008 5:14:15 PM
Rank: Newbie
Groups: Member

Joined: 7/3/2008
Posts: 9
Hello,

Thank you very much for your support. Still got question regarding FileUploader.

When I uploaded 2 files (for example) the files are listed as check box list with options for deleting them. Ok, then I click another button in the form which causes PostBack and after the postback I want to show my user how many files are uploaded and I want to allow the user delete one or two of them. But after the postback, I see that the uploaded list is gone and I cant make them persistent.

Actually I am developing a "CONTACT US" - EMAIL page where the user can upload files for email attachments. I allow them to attach only 2 files. Also in the same page, I have other buttons. So, if the user attach a file and then he clicks the other buttons and after that, he will see that no files are attached and he can upload 2 files again. So, there will be actually no limit of uploaded files in this scenario. Not only that, this scenario will confuse the user as he would think that the attached files are lost and he will need to upload again.

I believe that there must be some way to do that but I am simply missing as I am still new to this control and learning. So, would you please help me about it !

Regards
Emran
eo_support
Posted: Monday, July 7, 2008 5:38:44 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,193
Hi Emran,

Actually the uploader only keeps the temp file list. Once the files are submitted, the uploader hands over the files to you and no longer keeps the list. The following list detailed all the stages:

1. User uploads a file. At this stage:
a. The file is in the temp directory;
b. It has not been submitted yet;
c. Your code does not see this file;
d. User can delete it;

2. User hits another submit button. Now the files are submitted. At this stage:
1. The files are moved to final directory;
2. FileUploaded event is fired;
3. Your code now sees these files;
4. User no longer be able to delete them;

Once the files are handed over to you, it's all yours. You can use whatever means to keep the file list. For example, you can use a simple string varaible to save the list of files and then save it in view state. The uploader however, no longer keeps the list at this stage.

Thanks
eo_support
Posted: Tuesday, July 8, 2008 6:58:21 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,193
Hi,

We have posted a new build that added an AJAXPostedFileList control that can maintain a list of all posted files. Please see your private message for download location and details.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.