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
File Upload>2MB not Working?
Old 10-24-2011, 11:05 AM File Upload>2MB not Working?
Super Talker

Posts: 148
Trades: 0
Hi All,

I am trying out the file uploading bit and encountered some problems when uploading a file>2MB, it gives me an error like the one below:
Warning: Packets out of order. Expected 1 received 0. Packet size=33 in C:\Program Files (x86)\db_inc.php on line 150

So i played around and realized if i upload a file size smaller than 2MB, i do not encounter the error above and no code changes were being made. So i checked if it could be the max file upload size here to configure my systems. I am using WAMP by the way. So i changed the values to 16MB and 300 seconds.

Any idea what could be causing this? I am a bit stumped.
shaoen01 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 10-24-2011, 12:35 PM Re: File Upload>2MB not Working?
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,384
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
And are you trying to "upload" from the same machine?
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 10-24-2011, 08:37 PM Re: File Upload>2MB not Working?
Super Talker

Posts: 148
Trades: 0
Yes, i am just trying it out on localhost and it is weird i am encountering this error.
shaoen01 is offline
Reply With Quote
View Public Profile
 
Old 10-24-2011, 10:15 PM Re: File Upload>2MB not Working?
Super Talker

Posts: 148
Trades: 0
I just tested again and it seems if i upload text based files it is okay, but if i upload say jpg or pdf, there seems to be a problem. Below is my code:

PHP Code:
if(isset($_FILES['uploaded_file'])) {
    
// Make sure the file was sent without errors
    
if($_FILES['uploaded_file']['error'] == 0) {
        
$conn=connectDB();
        
         
// Gather all required data
        
$name mysql_real_escape_string($_FILES['uploaded_file']['name']);
        
$mime mysql_real_escape_string($_FILES['uploaded_file']['type']);
        
$tmpName=($_FILES  ['uploaded_file']['tmp_name']);
        
$data file_get_contents($_FILES  ['uploaded_file']['tmp_name']);
        
$size intval($_FILES['uploaded_file']['size']);
      
         
$query "insert into $tablename (Name,Type,Size,Content)".
        
"Values ('$name ','$mime ',$size ,'$data ')";
        
$result mysql_query($query);
        
         
// Check if it was successfull
        
if($result) {
            echo 
'Success! Your file was successfully added!';
        }
        else {
            echo 
"FAILED";
        }
        
        
closeDB($conn);
        
    }
    

shaoen01 is offline
Reply With Quote
View Public Profile
 
Old 10-25-2011, 09:11 AM Re: File Upload>2MB not Working?
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,384
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Possibly something to do with your router not handling "loopback" connections to well, most "home routers" don't.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 10-25-2011, 09:30 PM Re: File Upload>2MB not Working?
Super Talker

Posts: 148
Trades: 0
Quote:
Originally Posted by chrishirst View Post
Possibly something to do with your router not handling "loopback" connections to well, most "home routers" don't.
How do i check if my home router is able to do that? I am using DLink DIR655. I googled online and some say that this router has loopback but i am not sure how to configure. Any clue?
shaoen01 is offline
Reply With Quote
View Public Profile
 
Old 10-26-2011, 07:10 AM Re: File Upload>2MB not Working?
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,384
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Use another machine on your network and connect using the internal IP (192.168.x.x) see if that works ok, the the problem is with your router or the N.I.C. in the machine acting as server.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 10-27-2011, 09:33 PM Re: File Upload>2MB not Working?
Super Talker

Posts: 148
Trades: 0
I guess i will have to try that. Thanks
shaoen01 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to File Upload>2MB not Working?
 

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.22060 seconds with 12 queries