PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Mon Sep 16, 2019 12:13 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Wed Apr 18, 2007 10:46 am 
Offline
Forum Newbie

Joined: Wed Apr 18, 2007 10:38 am
Posts: 2
feyd | Please use
Syntax: [ Download ] [ Hide ]
,
[syntax=php]and
Syntax: [ Download ] [ Hide ]
  1. tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: to learn how to do it too. 
  2.  
  3.  
  4.  
  5.  
  6.  
  7. I am facing some trouble with uploadign multiple image files to my website. Whenever i upload less than 5 mb of files. The files ar uploaded successfully and are displayed with their thumbnails, etc. But when the total number of files size exceed to lets say 13 mb . There is error which comes up "Some unexpected error occured". Also sometimes it only displays a few files out of the total number of files uploaded. This error page also came up once. Warning: mkdir(): No such file or directory in /home/content/e/c/l/ecl123/html/photoalbum/upload.php on line 22 
  8.  
  9.  
  10.  
  11. I am pasting the upload.php file here. 
Syntax: [ Download ] [ Hide ]
<?php

session_start();

include('../includes/PHP/functions_user.inc');

include('../includes/PHP/MySql.Class.php');



$DB = new sql();





function saveUploadedFiles()



{



        $fileCount = $_POST ["FileCount"];



       

        $galleryPath = "Gallery/";



        //Iterate through uploaded data and save the original file, thumbnail, and description.



        chdir($galleryPath);



        mkdir($_GET['albumid'],0777);

       

        chdir("../");

       

        $galleryPath = $galleryPath.$_GET['albumid']."/";

       

        $sitepath.=$_GET['albumid']."/";



        for ($i = 1; $i <= $fileCount; $i++)



        {



                //Get source file and save it to disk.



                $sourceFileField = "SourceFile_" . $i;



                if (!$_FILES[$sourceFileField]['size'])



                {



                        return;



                }



                $fileName = getfilename($_FILES[$sourceFileField]['name'],$galleryPath);



//              move_uploaded_file($_FILES[$sourceFileField]['tmp_name'], $galleryPath  . $fileName);

               

                $photopath=$galleryPath . $fileName;

               

                $thumbnail1Field = "Thumbnail1_" . $i;

                $targetpath = "Gallery/";

                move_uploaded_file($_FILES[$thumbnail1Field]["tmp_name"], $galleryPath.$fileName);



                $sql_insert="insert into tblphoto set user_id=".$_SESSION['uid'].",album_id=".$_REQUEST['albumid'].",photo_path='".$photopath."'";

                mysql_query($sql_insert) or die($sql_insert.mysql_error());



        }

        $lastid=mysql_insert_id();

        $sql_update = "update tblphoto set cover_photo='1' where photo_id=".$lastid;

        mysql_query($sql_update);

}







//This method verifies whether file with such name already exists



//and if so, construct safe filename name (to avoid collision).



function getfilename($fileName,$galleryPath)



{



//      global $absGalleryPath;

       



       



        $newFileName = $fileName;



        $j = 1;



        while (file_exists($galleryPath . $newFileName))



        {



                $newFileName = $j . "_" . $fileName;



                $j = $j + 1;



        }



        return trim($newFileName);     



}







saveUploadedFiles();



?>



feyd | Please use
Syntax: [ Download ] [ Hide ]
,
[syntax=php]and
Syntax: [ Download ] [ Hide ]
  1. tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: to learn how to do it too. 


Last edited by avnikl on Thu Sep 13, 2007 3:45 pm, edited 1 time in total.

Top
 Profile  
 
PostPosted: Wed Apr 18, 2007 11:36 am 
Offline
Forum Newbie

Joined: Wed Apr 18, 2007 10:38 am
Posts: 2
I am also pasting my php.ini file, since some websites say that it could be a problem on the file size specified on the php.ini file

register_globals = off
allow_url_fopen = off

expose_php = Off
max_input_time = 60
variables_order = "EGPCS"
extension_dir = ./
upload_tmp_dir = /tmp
precision = 12
SMTP = relay-hosting.secureserver.net
url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=,fieldset="

[Zend]
zend_extension=/usr/local/zo/ZendExtensionManager.so
zend_extension=/usr/local/zo/4_3/ZendOptimizer.so


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group