Activity Stream
48,167 MEMBERS
64778 ONLINE
besthostingforums On YouTube Subscribe to our Newsletter besthostingforums On Twitter besthostingforums On Facebook besthostingforums On facebook groups

Results 1 to 5 of 5

Hybrid View

Mr. Goodie2Shoes working on an upload script... but... 26th May 2012, 12:03 PM
soft2050 The first bug which i see from the... 26th May 2012, 05:25 PM
Mr. Goodie2Shoes ooo... it works! damn you silly... 27th May 2012, 02:15 AM
soft2050 Using '@' before a local file path... 27th May 2012, 07:37 AM
Mr. Goodie2Shoes okay... so I moved the scripts to... 28th May 2012, 03:20 PM
Previous Post Previous Post   Next Post Next Post
  1.     
    #1
    Member
    Website's:
    UmNotaBlogger.com

    Default working on an upload script... but having problems...

    okay, for example, this is my domain: mydomain.com and the upload is in mydomain.com/admin/upload.php and its password protected...
    I'll be selecting a file and then from my database, the script will get the IP of a totally different server where the files will be uploaded... here's the part of the script:
    PHP Code: 
    if(isset($_FILES['file']) && isset($_REQUEST['subject']) && isset($_REQUEST['year'])){
        
    $subjectinfo mysql_query("SELECT * FROM ~something~ where subject_code='".$_REQUEST['subject']."'"DBH);
        
    $subjectinforow mysql_fetch_array($subjectinfo);
        
    $filename $_REQUEST['subject'].' - '.$subjectinforow['subject_name'].' - '.$_REQUEST['year'].'.zip';
        
    $checkiffileexist mysql_query("SELECT * FROM ~something~ WHERE file_name='".$filename."'"DBH);
        if(
    mysql_num_rows($checkiffileexist)){
            
    $fileexists TRUE;
        }else{
        
    $filesize $_FILES['file']['size'];
        
    $newkey generatekey($_SESSION['config']['file_key_length']);
        
    $checkkey mysql_query("SELECT * FROM ~something~ WHERE file_key='".$newkey."'"DBH);
        while(
    mysql_num_rows($checkkey)){
            
    $newkey generatekey($_SESSION['config']['file_key_length']);
        }
        
    $server $subjectinforow['server_ip'];    
        
    $location 'D:/downloadables/docs/'.$_REQUEST['subject'].'/'.$_REQUEST['year'].'.zip';
        
    $result mysql_query("INSERT INTO ~something~ (file_key, file_name, server_ip, file_location, file_size, file_hits) VALUES ('".$newkey."', '".$filename."', '".$server."', '".$location."', '".$filesize."', '0')"DBH);
        
    $ch curl_init('http://'.$server.'/~something~');
        
    $post '&pass=~something~';
        
    $post '&file='.$_FILES['file'];
        
    $post '&subject'.$_POST['subject'];
        
    $post '&year'.$_POST['year'];
        
    curl_setopt($chCURLOPT_POSTFIELDS$post);
        
    curl_setopt($chCURLOPT_RETURNTRANSFER1);
        
    curl_exec($ch);
        
    curl_close($ch);
        }

    I think this part of the code is working perfectly... and the upload script located in the server:
    PHP Code: 
    switch($_REQUEST['pass']){
        case 
    '~something~':
            
    $maindir 'D:/downloadables/docs/';
            
    $uploaddir $maindir.$_POST['subject'];
            if (!
    file_exists($uploaddir))
                @
    mkdir($uploaddir);
            
    move_uploaded_file($_FILES['file']['tmp_name'], $uploaddir.'/'.$_POST['year'].'.zip');
            break;
        default:
            
    header('Location: http://~something~');
            break;

    any kinda help will be really appreciated
    Mr. Goodie2Shoes Reviewed by Mr. Goodie2Shoes on . working on an upload script... but having problems... okay, for example, this is my domain: mydomain.com and the upload is in mydomain.com/admin/upload.php and its password protected... I'll be selecting a file and then from my database, the script will get the IP of a totally different server where the files will be uploaded... here's the part of the script: if(isset($_FILES) && isset($_REQUEST) && isset($_REQUEST)){ $subjectinfo = mysql_query("SELECT * FROM ~something~ where subject_code='".$_REQUEST."'", DBH); $subjectinforow = Rating: 5

  2.   Sponsored Links

  3.     
    #2
    Respected Member
    Website's:
    DL4Everything.com Soft2050.in
    The first bug which i see from the code is this:
    PHP Code: 
    $post '&pass=~something~';
        
    $post '&file='.$_FILES['file'];
        
    $post '&subject'.$_POST['subject'];
        
    $post '&year'.$_POST['year']; 
    • Assignment Operator
    • &year and &subject needs to have "=" after them

    So those lines in your code to something like this and it should work:
    PHP Code: 
    $post = array(
       
    'file' => '@' $_FILES['file']['tmp_name'],
       
    'subject' => $_POST['subject'],
       
    'year' => $_POST['year']
     ); 

  4.     
    #3
    Member
    Website's:
    UmNotaBlogger.com
    ooo... it works!
    damn you silly mistakes!
    btw, what is the exact use of '@'?

  5.     
    #4
    Respected Member
    Website's:
    DL4Everything.com Soft2050.in
    Using '@' before a local file path generates a array of file with these details: name, type, tmp_name, error, size. Then curl process the data in the post request.
    You can also try to use $_FILES['file'] instead of prefixing it like '@' . $_FILES['file']['tmp_name'] because the array created on the latter one is same.

  6.     
    #5
    Member
    Website's:
    UmNotaBlogger.com
    okay... so I moved the scripts to my main server and the file server... the main server is working perfectly, sending the file and info vip cURL and adding a MySQL row... but there's no file in the file server... through phpinfo(), I found that suhosin is enabled... is that the problem?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Wupload upload not working
    By jackamitsingh in forum General Discussion
    Replies: 1
    Last Post: 25th Oct 2011, 02:00 PM
  2. need working download and upload
    By accyuklad in forum Hosting Discussion
    Replies: 3
    Last Post: 9th Feb 2011, 11:46 AM
  3. Remote upload is not working for rs
    By happyvalentine in forum General Discussion
    Replies: 3
    Last Post: 14th Jan 2011, 02:13 PM
  4. working rapidshare upload plugin
    By ahmsgf in forum Technical Help Desk Support
    Replies: 7
    Last Post: 20th Nov 2010, 09:12 PM
  5. need a working megashares upload plugin
    By Daniel in forum Web Application/Script Support
    Replies: 0
    Last Post: 2nd Jul 2010, 05:42 PM

Tags for this Thread

BE SOCIAL