Welcome Guest Search | Active Topics | Sign In | Register

Renaming files uploaded by the uploader control Options
Teju
Posted: Friday, January 14, 2011 7:24:21 AM
Rank: Member
Groups: Member

Joined: 1/23/2009
Posts: 12
Hi,
Is there any way by which the uploaded file using the uploader control can be renamed rather than guid number which is default.?
Any help much appreciated
eo_support
Posted: Friday, January 14, 2011 8:31:09 AM
Rank: Administration
Groups: Administration

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

The GUID is not the default file name. The default file names are the same as the client side file name. The GUID files you saw are the temp files, which will either be moved (by you or by the uploader) or be deleted.

To let the uploader move (and rename) the files for you, you can simply set the uploader's FinalFileLocation property. If you wish to move (and rename) the files yourself, you can handle the uploader's FileUploaded event. Inside that event you can move the files to anywhere you want, or even save them to your database directly.

Thanks!
Teju
Posted: Friday, January 14, 2011 8:38:13 AM
Rank: Member
Groups: Member

Joined: 1/23/2009
Posts: 12
Hi,
Thanks, for your reply. As iam writing this, i did manage to get to the point which you mentioned.
The problem i have now is i have placed the uploader control within the detailsview and iam trying to get the values of the files uploaded on detailsview iteminserting event. Iam not sure whether this is possible or not but at the moment my difficulty is finding the uploader control and manipulating the filenames and updating the database.
Any help on this is much appreciated
eo_support
Posted: Friday, January 14, 2011 10:06:00 AM
Rank: Administration
Groups: Administration

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

You would do it the same way as you access any other server controls in your GridView. There is nothing special about the uploader regarding this. Also if you handle the uploader's FileUploaded event, you do not need to "find" the uploader at all because the uploader is passed to you directly as the first parameter of your event handler.

Thanks
Teju
Posted: Monday, January 17, 2011 3:03:53 AM
Rank: Member
Groups: Member

Joined: 1/23/2009
Posts: 12
Hi,
Below is my code for finding the control. But unfortunately it gives me error message as value of type system.web.ui.control cannot be converted to eo.web.ajaxpostedfile.
Dim fupResources1 As EO.Web.AJAXPostedFile = CType(dvLectUpdate.FindControl("fupResource1"), EO.Web.AJAXPostedFile)

I am not sure what i am doing wrong. Is it something really important iam missing
Thanks,
eo_support
Posted: Monday, January 17, 2011 8:05:55 AM
Rank: Administration
Groups: Administration

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

I am not sure how you come up the code. AJAXPostedFile is NOT a control. AJAXUploader is a control. Thus you can only find AJAXUploader through FindControl. You can only get AJAXPostedFile object through an AJAXUploader object.

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.