|
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
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,201
|
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!
|
|
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
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,201
|
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
|
|
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,
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,201
|
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!
|
|