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

Member Avatar

diafol

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.

OK aside that, could it be a .htaccess thing?

The problem is that the file doesnt go on its destination folder

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

Member Avatar

diafol

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.

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.
Member Avatar

diafol

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.