0

i have a site where a user can upload a video file

when i upload a small file 5MB it work fine , upload that file and redirects to the video list, but when i upload a 15MB file , the file is uploaded ok , but after the file was uploaded in the folder it doesnt redirect , instead shows a 500 internal server error.

here is my code

           if(isset($_POST['upload_file']))
           {

                  $user_id   = $current_user->ID;
                  $title     = $_POST['title'];

                  $video_upload = "";
                  if ( ! function_exists( 'wp_handle_upload' ) ) require_once( ABSPATH . 'wp-admin/includes/file.php' );
                  $uploadedfile = $_FILES['video_file'];
                  $upload_overrides = array( 'test_form' => false );
                  add_filter('upload_dir', 'my_upload_vid_dir');
                  $movefile = wp_handle_upload( $uploadedfile, $upload_overrides );
                  remove_filter('upload_dir', 'my_upload_dir');

                  if ( $movefile ) {
                      $video_upload = $movefile["url"];
                  }


                  if(have_rows('videos', 'user_'.$current_user->ID))
                    $videos = get_field('videos', 'user_'.$current_user->ID);
                  else
                    $videos = array();

                  //insert video to array
                  if($video_upload != "")
                  {
                      $videos[] = array( 'file_path' => $video_upload , 'title_video' => $title );
                      update_field("videos", $videos, 'user_'.$current_user->ID);
                 }

                 wp_redirect( site_url("video-upload") ); exit;
            }

once again the file is uploaded sucessfully i can see the file in the folder , but after upload i expect that the page be redirected to wp_redirect( site_url("video-upload") ); , but it shows 500 internal server error , someone that can help??? , sorry about my english

Luis Cardenas
  • 363
  • 4
  • 11
  • A 500 error means you need to check your web server's error log for more details, where the error should be spelled out. Always when developing and testing code, enable PHP's error reporting. Wordpress might have its own preferred method of doing that. http://codex.wordpress.org/Debugging_in_WordPress You will want to make PHP display the error on screen - the normal way is `ini_set('display_errors', 1);` but it looks like WP prefers `define('WP_DEBUG_DISPLAY', false);` – Michael Berkowski Nov 21 '14 at 15:40
  • 2
    Almost certainly, you are facing limits with PHP's default upload allowance. http://stackoverflow.com/questions/2184513/php-change-the-maximum-upload-file-size – Michael Berkowski Nov 21 '14 at 15:43
  • I suggest you to limit the size of files that you can upload. If you need to upload large files, you should modify the limits linked by @MichaelBerkowski and the max_execution_time for a script in your php.ini. – stuzzo Nov 21 '14 at 15:48
  • big files are uploaded , the problem that i have is with the redirect and big files, with big files this doesnt work wp_redirect( site_url("video-upload") ); – Luis Cardenas Nov 21 '14 at 15:52
  • and my error.log only display this: [Fri Nov 21 10:25:06 2014] [error] [client 200.58.78.242] File does not exist: /home/expresow/public_html/500.shtml, referer: http://expresoweb.com/stage/happening/video-upload/?upload_video=new – Luis Cardenas Nov 21 '14 at 15:53

0 Answers0