In my Model I want to add a string property that will save the url/path of an image. For that I need to add "Browse" button next to a textbox for the user to select file & also a Image to display the selected image.
How can I save this image somewhere else and not in the DB - as that will increase the size of DB and save time for transferring image from byte[] to file & vice-versa ? Like this, through out the project, I will have many images to upload & show. Right now I am on local DB, Is this possible to achieve, if so , how ?
The view file where I want to add browse & Image is like this :
it's inside
The view is created by Scafolding.
Joginder BangerPosted Mar 15, 2015, 10:52 AM
you can save the image in project, only save the path in db.I assume you want upload the six image if you are trying image convert to takes lot of time. I think better this idea save the image in project in folder. if you want show the image in any image then you can safe. I hope help this.
TerryPosted Mar 18, 2015, 1:53 PM
I tried to implement your method. I could save the path to the database but not the file. Right now I am working on LocalDatabse & saving file in a folder present in my project.
In my apsx, I have added a fileUpload Control "panFileBtn". In my InsertItem(), I have added the following code :
On clicking Insert button, I get this response - debug lines :
PAN HAS FILE : = True
PAN FILE NAME = Desert.jpg
################ File is BEING SAVED AT : D:\Trupti\Vincitore\Projects\TrialWebApplication\TrialWebApplication\CRMImages\Desert.jpg ################ UPLOADED PROCESS COMPLETED
After I close the application & check/refresh the CRMImages folder, I don't see this file present. In that place, if I give some otehr path like "D:\Images" or so, then it gets saved their properly.
Can you tell why I am not being able to save it in the CRMImages folder of the project itself. The location path is also correct.
Still I am not able to make what how to add & connect this FileUpload control with the Property of the Model. I am updating its' value in InsertItem(), that's ok but I got to add FileUpload control out of . So the property is in fieldset & this upload facility out of it. Please help me.
Can't find a way for this !!! Am struggling to add this feature since days.u
TerryPosted Mar 15, 2015, 12:47 PM