0

hello i want to upload an audio file. i specified the location but the file doesnt go there. it stores the path in the row in the table on database but it doesnt store the file on the folder.

i define the upload path on my config file

define("UPLOAD_PATH_AUDIO", "uploads_audio/");

and this is the php

$upload_path_audio='../'.UPLOAD_PATH_AUDIO;

$actual_image_name = 'audio'.$user_id.'_'.time().$i.".".$ext;
                $uploadedfile=$_FILES['audioaud']['tmp_name'][$name];
                $newwidth=$configurations[0]->upload;
                if(move_uploaded_file($uploadedfile, $upload_path_audio.$actual_image_name))
                //if($filename)
                {
                    internalAudioUpload($user_id,$actual_image_name,$group_id,$conversationImage);
                    $newdata=internalGetUploadImage($uid,$actual_image_name);

                    if($newdata)
                    { 
                        if(empty($v))
                        $v=$newdata[0]->id;
                        else
                        $v=$v.','.$newdata[0]->id;

                        echo '<img src="'.BASE_URL.'/wall_icons/profile-audio1.png" title="'.$AudioName.'"  class="preview updateControl" id="'.$v.'"/>';
                    }
                }
                else
                {
                echo "Fail upload fail.";
                }

i keep getting an Fail upload fail alert message

2
Contributors
7
Replies
42
Views
1 Year
Discussion Span
Last Post by diafol
0

Once again, we have quantum foam variables. $name, $ext etc

$uploadedfile=$_FILES['audioaud']['tmp_name'][$name];

This makes no sense to me. Why $name at the end? You have objects and user-defined functions all over the place. This is almost impossible to break down.

This post seems to be releated to another I just replied to.

0

I keep changing the php.ini and it changes back to its default state. Why is that?

0

Simon. We, well I anyhow, have absolutely no idea what you.re doing. You.ve asked 3 different questions, seemingly out of the blue. Approach this in a logical manner. Is the file being uploaded at all?

print_r($_FILES);

See if there is an error. If not, there may be write issues or your destination folfder may not exist. Again echo this out to see what.s hoing on.

0

sorry diafol. This is what i get

Array
(
    [name] =&gt; Array
        (
            [0] =&gt; LP - Lost On You [Official Video].mp3
        )

    [type] =&gt; Array
        (
            [0] =&gt; 
        )

    [tmp_name] =&gt; Array
        (
            [0] =&gt; 
        )

    [error] =&gt; Array
        (
            [0] =&gt; 1
        )

    [size] =&gt; Array
        (
            [0] =&gt; 0
        )

)
Fail upload fail.
3

OK, error = 1 This means your filesize is greater than allowed in php.ini

http://www.php.net/manual/en/features.file-upload.errors.php

A quick fix, would be to change your setting (here's the revelant section of my local php.ini) :

;;;;;;;;;;;;;;;;
; File Uploads ;
;;;;;;;;;;;;;;;;

; Whether to allow HTTP file uploads.
; http://php.net/file-uploads
file_uploads=On

; Temporary directory for HTTP uploaded files (will use system default if not
; specified).
; http://php.net/upload-tmp-dir
upload_tmp_dir="C:\xampp\tmp"

; Maximum allowed size for uploaded files.
; http://php.net/upload-max-filesize
upload_max_filesize=8M

; Maximum number of files that can be uploaded via a single request
max_file_uploads=20

Note the upload_max_filesize=8M setting - this means 8Mb - you probably have yours set to 2M. Whenever you change a php.ini setting, remember to restart Apache.

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.