Topic: drag and drop file upload plugin destination Folder
gerdhuber pro asked 5 years ago
Expected behavior I bought the plugin Drag and Drop Fileupload. Unfortunately, I can not find an example of where the file upload is stored. Please give me an example Actual behavior
Resources (screenshots, code snippets etc.)
lemons free answered 5 years ago
you have to send it to your backend like a "normal" form!
then you have to grab the content of the POST and store it wherever you want.
NOTE: you properly have to discover the file extension serversides, rename the file and map the original filename to the new (unique) filename somehow in your database.
// ## simplyfied Laravel example ## //
// method to be called from form action
public function storeImage() {
// check if data is submitted properly
if($image = request()->image){
// store image in the uploads directory with the name of 'image.jpg'
Storage::disk('public')->putFileAs('uploads', new File($image), 'image.jpg');
}
// return redirect after upload is complete
return redirect()->back();
}
Grzegorz Bujański staff commented 5 years ago
@gerdhuber heres your answer. Did you have some backend like Laravel? You need backend, to upload your file somewhere.
Grzegorz Bujański staff answered 5 years ago
Hi. Here you have getting started tutorial: https://mdbootstrap.com/plugins/jquery/file-upload/#docsTabsAPI
gerdhuber pro commented 5 years ago
Thank you for your reply. I would like to know how to submit the folder on the server by the upload saves his data. Is there a example
Grzegorz Bujański staff commented 5 years ago
Sadenlly not. You need use ajax and some server side scripts.
gerdhuber pro commented 5 years ago
Please say me, where(in which folder) the plugin saves the uploaded file
Closed
This topic is closed.
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Closed
- ForumUser: Pro
- Premium support: No
- Technology: MDB jQuery
- MDB Version: 4.10.0
- Device: PC
- Browser: Firefox
- OS: windows10
- Provided sample code: No
- Provided link: No