I have one form which contains one file upload.
Form Id is "upload_form"
<input type="file" id="image" name="image"/>
Using javascript onclick function and ajax to pass the image to the controller.
Ajax fn:
$.ajax({
url: 'UploadImage',
data:new FormData($("#upload_form")[0]),
type: "post",
dataType:"JSON",
async:false,
success: function (data) {
console.log(data);
}
});
}
Routes:
Routes::post('UploadImage','UploadController@Upload');
UploadController:
public function Upload()
{
//I want to catch the image here and save in temporary file in server
//and then want to save the URL in database.
//Model Name : UserData
//Column name: ImageUrl
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire