Last post Dec 10, 2012 08:40 AM by bangtheory
Dec 09, 2012 11:13 AM|bangtheory|LINK
This works as far as, getting the actual file name an storing it to the database. But I need this to store the physical path and filename
<asp:Button ID="InsertButton" runat="server" CommandName="Insert"
<asp:Button ID="CancelButton" runat="server" CommandName="Cancel"
<asp:FileUpload ID="FileUpload1" FileName='<%# Bind("thumb") %>' runat="server" />
This currently saves
I need this to save the reference path AND filename
Dec 09, 2012 08:46 PM|oned_gk|LINK
Try using iteminserting event to change filename value, this VB sample code
e.Values("tumb") = "images/thumbs/" & e.Values("tumb")
Dont save physical path if you want use the field as URL because URL and physical path is defernt
Dec 10, 2012 12:25 AM|Decker Dong - MSFT|LINK
But I need this to store the physical path and filename
We don't suggest you doing that.
Because if you save the physical path, maybe it's an absolute one, which isn't useful for publishing futher.
So virtual path is recommanded.
Dec 10, 2012 08:28 AM|bangtheory|LINK
Ok so none of these solutions work and there are others telling me not to do this.
This is all local, Not actually uploading images. The images are already there in the folder. I just need to store the image paths to the database using the FileUpload control. But the FileUpload control only shows the file name
xxxxx.jpg I need it to store xxx\xxxx\xxxx.jpg on save.
Dec 10, 2012 08:33 AM|oned_gk|LINK
Simply modify your insert/update command
UPDATE YOURTABLE SET FILEPATH = 'images\thumbs\' + @FILENAME
Dec 10, 2012 08:40 AM|bangtheory|LINK
I once had this as a repeater control, I changed it to a listview control. The database solution work thanks oned. I didn't know I could do that.