Click here to Skip to main content
15,913,467 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Helo,

how can we transfer image file from upload button to the database mysql and retreive the image and display it on the same page
Posted
Comments
bhagirathimfs 24-May-12 2:09am    
transfer means?
Want to store the image in the database or anything else?
Sandeep Mewara 25-May-12 1:37am    
Did you try anything so far?
Prasanna Kumari 25-May-12 5:35am    
ya i has to store it on the database.But first i has to send that browse url to the controller and i will take that url as HttpPostedFileBase so i will take that path as file .So in view i has to take that file and pass it to the controller.In controller i has to save it on the database

1 solution

in ajax you may not have the opportunity to upload a file. but With javascript you can this is how you can do:

PHP
<form name=fileuploader id=fileuploader method=post action='upload_handle.ext' enctype="multipart/form-data" target='UploadedFrame'>
<input type='file' name='csv' id='csv' onchange='document.getElementById("fileuploader").submit()' Title='Select File Name'>

</form>
<iframe id='UploadedFrame' name='UploadedFrame' style='display:none'></iframe>


with HTML5 you can also work with size and other issues
 
Share this answer
 
Comments
Prasanna Kumari 25-May-12 5:38am    
Hi,Thanks For the reply
So is this one transfers the file to the controller
Mohibur Rashid 25-May-12 6:00am    
submit function will transfer, and no page refreshing event will done by targeting iframe. I have several application running on this simple method

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900