NILAY PATEL
NILAY PATEL

Reputation: 78

Upload .WMV and .FLV using PHP

I would like to upload .wmv and .flv files using Uploadify and PHP. However, I can't seem to get it right.

Here's my code:

$(function() {
    $("#file_upload").uploadify({
        'swf'         : 'uploadify/uploadify.swf',
        'uploader'    : 'uploadify/uploadify.php',
        'uploadLimit' : 1,
        'folder'    : 'uploads',
        'method'   : 'post',
        'auto'      : true,
        'multi'     : true,
        'fileExt'   : '*.jpg; *.gif; *.png; *.jpeg; *.wmv; *.flv',
         'onUploadSuccess' : function(file, data, response) {
        alert('The file was saved to: ' + file);
             } 
    });
});

Uplodify.php

$targetFolder = '/uploads'; // Relative to the root

if (!empty($_FILES)) {
    $tempFile = $_FILES['Filedata']['tmp_name'];
    $targetPath = $_SERVER['DOCUMENT_ROOT'] . $targetFolder;
    $targetFile = rtrim($targetPath,'/') . '/' . $_FILES['Filedata']['name'];

    // Validate the file type
    $fileTypes = array('jpg','jpeg','gif','png','wmv'); // File extensions
    $fileParts = pathinfo($_FILES['Filedata']['name']);

        move_uploaded_file($tempFile,$targetFile);
}

Any ideas as to what I'm doing wrong?

Upvotes: 0

Views: 695

Answers (1)

mortimer
mortimer

Reputation: 66

You probably just need to increase the maximum upload limit have a read of http://css-tricks.com/snippets/php/increase-maximum-php-upload-size/

Upvotes: 1

Related Questions