Comments Andrew Cole started the conversationApril 4, 2022 at 7:22amThe template we purchased allows me to drag and drop images but stops there. I need to know what code adaptations to make to cause the image to actually upload onto my server[deleted] repliedApril 5, 2022 at 9:02amHi Andrew Cole,By default file uploading is not handled by Neon theme, it is a "fake" upload success message for security reasons.To process and move uploaded file from:https://demo.neontheme.com/forms/file-upload/Example: Dropzone - Drag n' Drop File UploadIt sends requests to "data/upload-file.php"In upload-file.php to handle upload you can add the following example code (but you should add security measures as well): $ds = DIRECTORY_SEPARATOR; //1 $storeFolder = 'uploads'; //2 if ( ! empty( $_FILES ) ) { $tempFile = $_FILES['file']['tmp_name']; //3 $targetPath = dirname( __FILE__ ) . $ds . $storeFolder . $ds; //4 $targetFile = $targetPath . $_FILES['file']['name']; //5 move_uploaded_file( $tempFile, $targetFile ); //6 } Store directory separator (DIRECTORY_SEPARATOR) to a simple variable. This is just a personal preference as we hate to type long variable name.Declare a variable for destination folder.If file is sent to the page, store the file object to a temporary variable.Create the absolute path of the destination folder.Create the absolute path of the uploaded file destination.Move uploaded file to destination.Here is the article that explains the full process:https://startutorial.com/view/dropzonejs-php-how-to-build-a-file-upload-formI hope this helps you. Sign in to reply ...
The template we purchased allows me to drag and drop images but stops there. I need to know what code adaptations to make to cause the image to actually upload onto my server
Hi Andrew Cole,
By default file uploading is not handled by Neon theme, it is a "fake" upload success message for security reasons.
To process and move uploaded file from:
https://demo.neontheme.com/forms/file-upload/
Example: Dropzone - Drag n' Drop File Upload
It sends requests to "data/upload-file.php"
In upload-file.php to handle upload you can add the following example code (but you should add security measures as well):
Here is the article that explains the full process:
https://startutorial.com/view/dropzonejs-php-how-to-build-a-file-upload-form
I hope this helps you.