Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 07-22-2008, 10:15 AM File Upload
yashory's Avatar
Novice Talker

Posts: 12
Trades: 0
Actually I've tried this script and it runs but it nolonger runs now
don't know why??
PHP Code:
<?php
   
//the file upload script.
     
if($_FILES['file']['error']>0)
        { echo(
"Error :".$_FILES['file']['error']);}
    else
         {echo(
"Upload File:".$_FILES['file']['name']."<br>");
          echo(
"Type Of File:".$_FILES['file']['type']."<br>");
          echo(
"Size Of File:".$_FILES['file']['size']."<br>");
          echo(
"The File Stored In:".$_FILES['file']['tmp_name']);}
   
//Restrictions On Uploaded Files (Only Images).
    
if((($_FILES['file']['type']=="image/gif") || ($_FILES['file']['type']=="image/pjpeg") || ($_FILES['file']['type']=="image/png")) && ($_FILES['file'] ['size']<20000))
      {if(
$_FILES['file']['error']>0)
             {echo(
"Error:".$_FILES['file']['error']);}
         else
            {echo(
"Uploaded File:".$_FILES['file']['name']."<br>");
              echo(
"File Size:".$_FILES['file'['size']."<br>");
              echo(
"File Type:".$_FILES['file']['type']."<br>");
              echo(
"File Saved In:".$_FILES['file']['tmp_name']); }
         }
       else
         {echo(
"Invalid File!");}
      
//To Change The Uploaded File Location To A Folder With The Name Upload.
       
if(file_exists("upload/".$_FILES['file']['name']))
          {echo(
"The File".$_FILES['file']['name']."Already Exists");}
       else
           {
move_uploaded_file($_FILES['file']['tmp_name'],'upload/'.$_FILES['file']['name']);}
What Do you Think About this Script Guys??
yashory is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 07-22-2008, 03:18 PM Re: File Upload
KieranC's Avatar
Average Talker

Posts: 20
Trades: 0
Try here: http://www.w3schools.com/php/php_file_upload.asp
KieranC is offline
Reply With Quote
View Public Profile
 
Old 07-22-2008, 03:52 PM Re: File Upload
TheHosted's Avatar
Skilled Talker

Posts: 64
Name: Michelle
Location: Cyber Space
Trades: 0
How big of a file are you trying to upload? Most servers have a limit on file size you can upload via any script. I would check with your host and see what that limit is.
__________________

Please login or register to view this content. Registration is FREE
- Hosting Since 2004 With End User Support

Accepting Paypal, Moneybookers, Google Checkout, & More.
Proudly Designed By:
Please login or register to view this content. Registration is FREE
TheHosted is offline
Reply With Quote
View Public Profile Visit TheHosted's homepage!
 
Old 07-22-2008, 07:49 PM Re: File Upload
JeremyMiller's Avatar
WT Moderator

Posts: 1,712
Name: Jeremy Miller
Location: Las Vegas, NV
Trades: 0
Nothing stands out to me on cursory inspection except that you said it doesn't run. All scripts either run or they throw an error. Are you getting an error? If so, what is it? If you're not getting an error then try it with

PHP Code:
echo '<pre>',print_r($_FILES,true),'<pre>'
at the top of the script (but inside the <?php) to see what's actually being received. Then, you can compare it against what's in the code.
__________________
Jeremy Miller

Please login or register to view this content. Registration is FREE
JeremyMiller is offline
Reply With Quote
View Public Profile Visit JeremyMiller's homepage!
 
Reply     « Reply to File Upload
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.21657 seconds with 12 queries