Send blob from javascript to PHP and save it as a file on server
€30-250 EUR
Completed
Posted over 3 years ago
€30-250 EUR
Paid on delivery
We are looking for a PHP / JAVASCRIPT / AJAX / JQUERY developer with experience in files use. It's a simple job. We provide two downloadable scripts, without execution environment, to modify the code and we perform the tests.
We have two files:
1) [login to view URL]
This file contains an HTML / PHP form with text inputs and a file type input.
We used it to upload a file by sending the data via $_POST to the second file.
2) [login to view URL]
This file is a PHP script that obtains the $_POST and $_FILES data and saves the image to the server and the inputs to the database.
We are integrating a javascript image editor, so the user can now edit the image before uploading it.
It works correctly but this script returns a blob, not a file in an input as we had before.
We can visualize the blob in the body, we have its url:
// Create preview image and append to body element
var image = new Image();
[login to view URL] = [login to view URL]([login to view URL]);
We want, instead of previewing this blob, to send it together with the text inputs to the [login to view URL] file to continue the same data collection process.
We are looking for someone able to *save the content of this blob in a hidden input file*, together with the rest of the values of the form, or to *send all the values of the form from javascript* and collect them in PHP in the second file [login to view URL], or able to *save the file in a temp folder in the server and save this url to the form so we can read the file from PHP*. Currently we obtain the file with $_FILES:
if (isset($_FILES['uploadedFile']) && $_FILES['uploadedFile']['error'] === UPLOAD_ERR_OK && $_FILES['uploadedFile']['size'] > 1)
{
// get details of the uploaded file
$fileTmpPath = $_FILES['uploadedFile']['tmp_name'];
$fileName = $_FILES['uploadedFile']['name'];
$fileSize = $_FILES['uploadedFile']['size'];
$fileType = $_FILES['uploadedFile']['type'];
$fileNameCmps = explode(".", $fileName);
$fileExtension = strtolower(end($fileNameCmps));
// sanitize file-name
$newFileName = md5(time() . $fileName) . '.' . $fileExtension;
// check if file has one of the following extensions
$allowedfileExtensions = array('jpg', 'png', 'jpeg');
(...)
ImageJPEG($dst_img,'./i/laspichas/' . $user_nicename .'/' . date("m") . date("Y") . '/'.
$newFileName,65);
The image name is not important, must be random. The type will be image (jpg jpeg gif png). The size should be calculated.
We are using DOKA to generate the blob. -> [login to view URL]
Greetings It’s Serhan, a passionate fullstack web developer. I will make your needs (save the content of this blob in a hidden input file) to be done in a no time. Feel free to share details with me. Have a nice day.
Kind regards.
€80 EUR in 1 day
5.0 (16 reviews)
4.5
4.5
7 freelancers are bidding on average €122 EUR for this job
Hi, there
I am a professional PHP developer who has over 10 years of experience.
I read your job description carefully and I am very interested in your job.
Regarding after your job post, I am sure of the success of your project. I promise I will keep the deadline, fix bugs and deliver a qualified code so that you will be satisfied with my work.
I can start working right now and can fully complete your job 100%.
Looking forward to your chatting and really hope to work with you.
Thanks.
Hi There,
I have a visual of your project description & grasp all your requirements. But few questions are grappling up in my mind. I need to clarify these queries via chat. Please come over the chat to discuss methodological aspects. And provide all the documental details in chat.
Please check my certifications to estimate my skills.
Regards,
Hi jesscobarroyepe. I've read your description crefully and grasped your requirements.
I've 5+ years of experince in PHP, JavaScript, and Ajax.
So, I can finish your project perfetly.
Let's disucss more detials by chatting.
Thanks.
Hi greetings
it's Narendra Kumar full stack developer, I go through your requirements and ok am capable to fulfill the requirements, because I have the skills and experience as well.