In my application i have file upload features where users can upload image and video files. I am able to upload all the files except .3gp. When i print in my back end i am getting empty array. File size which i am uploading is 10 MB and max upload in my php.ini is 20 MB. Below is my sample code which is working fine for other file extension.
Front End
<form method="post" name="addAssets" action="/examengine/assets/addassets" enctype="multipart/form-data">
<input type="file" name="upload" class="custom-file-input" id="customFile">
<button type="submit" class="btn pri-btn">Upload</button>
</form>
Backend
function addassets(){
var_dump($_POST);
var_dump($_FILES);
}
Problem Resolved
I changed post_max_size and resolved.
Related
My source code is to print upload SWF file tmp_name ?
<?php
echo json_encode($_FILES);
?>
<form method="POST" action="#" enctype="multipart/form-data" novalidate>
<input type="file" id="image" name="image" />
<input id="send" type="submit" name="data" value="Submit" />
</form>
But result i'm getting
{"image":{"name":"file.swf","type":"","tmp_name":"","error":1,"size":0}}
I have tried image uploading method no use on that !
{"image":{"name":"file.swf","type":"","tmp_name":"","error":1,"size":0}}
^^^^^^^^^
This error isn't specific to Flash at all. You'd run into the same issue with other formats as well.
Error 1 is UPLOAD_ERR_INI_SIZE. It means that the file you tried to upload was larger than your server's maximum upload size (upload_max_filesize), so the server didn't accept it.
Change this configuration value, or upload a smaller file.
I have simple html form with post method, which sends an image to my action.php file:
<form action="action.php" method="post" enctype="multipart/form-data">
<input type="text" name="name"/>
<input type="file" name="avatar"/>
<input type="submit" name="submit" value="Create"/>
</form>
And my action.php file looks like this:
if(isset($_POST['name'])) {
$error = $_FILES['avatar']['error'];
echo $error;
}
It works fine with small sized images, but when I try to submit images with approximately 2mb size the server just stops responding. It even doesn't send post request to my action.php.
Note: I've already set my upload_max_filesize = 64M, but the same thing is happening. It doesn't show any errors
Change the value of post_max_size = 70M.
Must be greater than or equal to upload_max_filesize.
After modifying php.ini file(s), you need to restart your HTTP server to use new configuration.
If problem persist you could try these solutions (1,2,3).
I've following HTML code to upload image file :
<form id="request_form" method="post" enctype="multipart/form-data" action="print.php">
<input type="file" name="student_image" id="student_image" accept="image/*" capture/>
<button type="submit">Submit</button>
</form>
PHP code is as follows :
<?php
print_r($_FILES);// Here I'm getting blank $_FILES array for few specific image files which are greater than 10 MB in size
?>
Following are the file upload setting from my php.ini file:
upload_max_filesize = 10M
post_max_size = 10M
I'm getting the blank array when I try to upload image files which are greater than 10 MB in size.
Please help me out from this issue.
You need to change your php.ini file and set greater value than 10M, it is config for Apache, and Apache doesn't let you to send big image and files before it
I'm currently working on a photoalbum thing on my website and was wondering is there is a way to upload files separately even though I selected multiple files for upload, let me explain:
<form method="post" action="upload.php" enctype="multipart/form-data">
<input name='uploads[]' type="file" accept="image/*" multiple>
<input type="submit" value="Send">
</form>
<?php
$y=count($_FILES['uploads']);
for($x=0;$x<$y;$x++) {
echo $_FILES['uploads']['name'][$x];
echo "<br>";
}
?>
So I've got these simple lines of code. And basically (As you can see) you can upload multiple files. But let's say that that my 'upload_max_filesize' is at 8M. I can only select 4 images of 2MB each to upload successfully, otherwise I overwrite the max upload size. My question is, is there a PHP way to keep the form structure the same but let the script handle one file at the time so I can upload 5.000 files from 5MB's each for example?
I know this is an old question and I have found lots of tutorial on SO however, they cannot solve my problem.
I use my mac to set up a localhost for web programming and I try to upload a jpg file to my localhost directory "/Library/WebServer/Documents". But it gives hint unable to move.
my front end code is:
<form action="upload_file.php" method="post"
enctype="multipart/form-data">
<label for="file">Filename:</label>
<input type="file" name="file" id="file"><br>
<input type="submit" name="submit" value="Submit">
</form>
The php(upload_file.php) code is(there is some other checking codes for php file, copied from w3school):
move_uploaded_file($_FILES["file"]["tmp_name"] , "/Library/WebServer/Documents" . $_FILES["file"]["name"]);
And after I click the submit button, there is sth wrong printed on the screen.
Moreover, I did not find any tmp file in the file "/private/var/tmp", in which should be a tmp file...
make sure your php file has enough rights to write into the directory.
check if print_r($_FILES); lists anything, especially the size is important.