Comments on: Ajax File Upload with Form Data using PHP https://www.codexworld.com/ajax-file-upload-with-form-data-jquery-php-mysql/ Web & Mobile App Development Company Thu, 03 Nov 2022 18:27:16 +0000 hourly 1 By: santi https://www.codexworld.com/ajax-file-upload-with-form-data-jquery-php-mysql/comment-page-1/#comment-221127 Thu, 03 Nov 2022 18:27:16 +0000 https://www.codexworld.com/?p=2991#comment-221127 sir, how do you rename files?

]]>
By: Ryanid https://www.codexworld.com/ajax-file-upload-with-form-data-jquery-php-mysql/comment-page-1/#comment-161165 Wed, 12 Jan 2022 08:32:54 +0000 https://www.codexworld.com/?p=2991#comment-161165 Thank you, it’s working.

]]>
By: mohamed husein https://www.codexworld.com/ajax-file-upload-with-form-data-jquery-php-mysql/comment-page-1/#comment-133118 Mon, 25 Jan 2021 03:23:32 +0000 https://www.codexworld.com/?p=2991#comment-133118 Thanks

]]>
By: FADI RIACHI https://www.codexworld.com/ajax-file-upload-with-form-data-jquery-php-mysql/comment-page-1/#comment-107096 Tue, 10 Mar 2020 17:17:40 +0000 https://www.codexworld.com/?p=2991#comment-107096 Can we add multiple image upload feature with this ?

]]>
By: Jeremiah Succeed https://www.codexworld.com/ajax-file-upload-with-form-data-jquery-php-mysql/comment-page-1/#comment-98446 Sat, 23 Nov 2019 17:05:34 +0000 https://www.codexworld.com/?p=2991#comment-98446 Thank you!

]]>
By: John Oluwaseyi https://www.codexworld.com/ajax-file-upload-with-form-data-jquery-php-mysql/comment-page-1/#comment-86338 Tue, 28 May 2019 10:05:06 +0000 https://www.codexworld.com/?p=2991#comment-86338 Please, how can I add another file field into the code?

]]>
By: CodexWorld https://www.codexworld.com/ajax-file-upload-with-form-data-jquery-php-mysql/comment-page-1/#comment-77224 Mon, 04 Feb 2019 04:58:48 +0000 https://www.codexworld.com/?p=2991#comment-77224 In reply to djalel.

Specify the MIME type (application/pdf) to allow uploading the PDF file.

JavaScript Code:

var match= ["image/jpeg","image/png","image/jpg", "application/pdf"];
if(!((imagefile==match[0]) || (imagefile==match[1]) || (imagefile==match[2]) || (imagefile==match[3]))){
    alert('Please select a valid image file (JPEG/JPG/PNG/PDF).');
    $("#file").val('');
    return false;
}

PHP Code:

$valid_extensions = array("jpeg""jpg""png""pdf");

if((($_FILES["hard_file"]["type"] == "image/png") || ($_FILES["file"]["type"] == "image/jpg") || ($_FILES["file"]["type"] == "image/jpeg")) || ($_FILES["file"]["type"] == "application/pdf") && in_array($file_extension$valid_extensions)){
    //upload code goes here
}
]]>
By: djalel https://www.codexworld.com/ajax-file-upload-with-form-data-jquery-php-mysql/comment-page-1/#comment-76896 Thu, 31 Jan 2019 20:24:20 +0000 https://www.codexworld.com/?p=2991#comment-76896 can you please help me to add pdf extension

]]>
By: fayzo https://www.codexworld.com/ajax-file-upload-with-form-data-jquery-php-mysql/comment-page-1/#comment-69452 Mon, 19 Nov 2018 14:49:41 +0000 https://www.codexworld.com/?p=2991#comment-69452 thx for help me

]]>
By: srijan https://www.codexworld.com/ajax-file-upload-with-form-data-jquery-php-mysql/comment-page-1/#comment-54535 Mon, 05 Mar 2018 07:48:45 +0000 https://www.codexworld.com/?p=2991#comment-54535 how can we add more fields in the form and insert them into the database

]]>