0

With following code I tried to upload image and video file at the same time but, image file is uploading & video file is not uploading

<form class="pure-form pure-form-aligned" action="Processor.php" method="post" enctype="multipart/form-data" >
  <fieldset> 

  <div class="pure-control-group">
      <label for="image">Upload image</label>
      <input type="file" name="image" class="pure-input-1-4" />
    </div>
    <div class="pure-control-group">
      <label for="video">Upload video</label>
      <input type="file" name="video" class="pure-input-1-4"  />
    </div>

  </fieldset>
  <div class="pure-controls">
    <input type="submit" name="submit" value="Submit"  class="pure-button pure-button-primary" />
  </div>
</form>

php

$target1 = "../image/";  
$target2 =  time() . rand(11, 99). basename( $_FILES['image']['name']) ; 
$target3 = $target1 .  $target2;

$target4 = "../video/";  
$target5 =  time() . rand(11, 99). basename( $_FILES['video']['name']) ; 
$target6 = $target4 .  $target5;



if(move_uploaded_file($_FILES['image']['tmp_name'], $target3))  
{ 
    echo "The file &ldquo;". basename( $_FILES['image']['name']). "&rdquo; has been uploaded <br>"; 
} 
else 
{ 
    echo "Sorry, there was a problem uploading your file.\n <br>"; 
} 

if(move_uploaded_file($_FILES['video']['tmp_name'], $target6))  
{ 
    echo "The file &ldquo;". basename( $_FILES['video']['name']). "&rdquo; has been uploaded <br>"; 
} 
else 
{ 
    echo "Sorry, there was a problem uploading your file.\n <br>"; 
} 
3
Contributors
16
Replies
32
Views
2 Years
Discussion Span
Last Post by joshuajames.delacruz
Featured Replies
  • You need to set the value of upload_max_filesize and post_max_size in your php.ini : ; Maximum allowed size for uploaded files. upload_max_filesize = 40M ; Must be greater than or equal to upload_max_filesize post_max_size = 40M After modifying php.ini file(s), you need to restart your HTTP server to use new … Read More

0

By default the upload file size is 2mb. Is the video file larger? If yes, check your PHP.INI.

Edited by pritaeas

1

You need to set the value of upload_max_filesize and post_max_size in your php.ini :

; Maximum allowed size for uploaded files.
upload_max_filesize = 40M

; Must be greater than or equal to upload_max_filesize
post_max_size = 40M

After modifying php.ini file(s), you need to restart your HTTP server to use new configuration.

If you can't change your php.ini, you're out of luck. You cannot change these values at run-time; uploads of file larger than the value specified in php.ini will have failed by the time execution reaches your call to ini_set.

See the Manual Click Here

0

code is working for below 2mb files.
trying to reset php.ini

does following code will work? (not working for me yet)

<?php
    ini_set('upload_max_filesize', '200M'); 
?>
0

altered value for 'upload_max_filesize' to 200m in php.ini file. still not working for bigger than 6mb videos

0

try to find where your php.ini file is

most of the time im using xampp so the location of my php.ini is

xampp\php\php.ini

Edited by joshuajames.delacruz

0
> code is working for below 2mb files.
> trying to reset php.ini
> does following code will work? (not working for me yet)
> <?php
>    ini_set('upload_max_filesize', '200M'); 
> ?>

does the video upload to the folder?

Edited by joshuajames.delacruz

0

phpinfo(); have following values

upload_max_filesize 200MB 200MB
post_max_size 8M 8M
file_uploads On On

should I change value of post_max_size ??? if yes mention value?

0

your post_max_size can be the same as the upload_max_size

if you alter the php.ini you need to restart apache

Edited by joshuajames.delacruz

0

restarted again & again
even restarted PC
But no result

0

Is it possible that it will work well with larger files on webserver from webhosting service?

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.