+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: problem uploading

  1. #1
    hyeclass is offline x10 Sophmore hyeclass is an unknown quantity at this point
    Join Date
    Dec 2005
    Posts
    174

    problem uploading

    i made me a php uploader for my site but i cant seem to upload a movie.... altho nothing in the code it blocking it.... no errors or anything... just it keeps loading very long then says page not found ....

    i did it like this
    copy($_FILES[movie][tmp_name]; "uploads/video/");
    also tried move_uploaded_file($_FILES[movie][tmp_name]; "uploads/video/");

    this is kinda urgent depending on my site's rep anybody wanna give a hand? please
    http://x-pose.tk

    http://bugz-inc.tk

  2. #2
    ironcross77's Avatar
    ironcross77 is offline x10 Sophmore ironcross77 is an unknown quantity at this point
    Join Date
    Mar 2005
    Location
    Kolkata, India
    Posts
    228

    Re: problem uploading

    What error it is giving?
    X10 ROCKS

  3. #3
    hyeclass is offline x10 Sophmore hyeclass is an unknown quantity at this point
    Join Date
    Dec 2005
    Posts
    174

    Re: problem uploading

    there is no error...just giving me a 404 page not found
    http://x-pose.tk

    http://bugz-inc.tk

  4. #4
    hyeclass is offline x10 Sophmore hyeclass is an unknown quantity at this point
    Join Date
    Dec 2005
    Posts
    174

    Re: problem uploading

    i just changed my code into this it still makes the same mistake
    PHP Code:
    <?
    ///smilies
    echo "<script language=\"javascript\">
    <!--
    function writeImgTag(code)
    {
    var cache = document.form1.comment.value;
    this.code = code;
    document.form1.comment.value = cache + code;
    document.form1.comment.focus();
    }
    //-->
    </script>"
    ;
    $befor = array(':)',':(',':p','B)','rolly','(l)',':ninja:',';)','<_<',':s',':o',':D',':wtf:');
    $after = array("<img onClick=\"writeImgTag(' :) ')\" src=\"smilies/smile.gif\" >","<img onClick=\"writeImgTag(' :( ')\" src=\"smilies/frown.gif\">","<img onClick=\"writeImgTag(' :p ')\" src=\"smilies/tongue.gif\">","<img onClick=\"writeImgTag(' B) ')\" src=\"smilies/cool.gif\">","<img onClick=\"writeImgTag(' rolly ')\" src=\"smilies/rolleyes.gif\">","<img onClick=\"writeImgTag(' (l) ')\" src=\"smilies/wub.gif\">","<img onClick=\"writeImgTag(' :ninja: ')\" src=\"smilies/ph34r.gif\">","<img onClick=\"writeImgTag(' ;) ')\" src=\"smilies/wink.gif\">","<img onClick=\"writeImgTag(' <_< ')\" src=\"smilies/dry.gif\">","<img onClick=\"writeImgTag(' :s ')\" src=\"smilies/unsure.gif\">","<img onClick=\"writeImgTag(' :o ')\" src=\"smilies/ohmy.gif\">","<img onClick=\"writeImgTag(' :D ')\" src=\"smilies/biggrin.gif\">","<img onClick=\"writeImgTag(' :wtf: ')\" src=\"smilies/blink.gif\">");
    ///smilies

    if($_POST[Submit])
    {

    if (
    $_POST[type] == "foto")
    {
    $subfolder "$_POST[type]/$_POST[subfolder]";
    }
    else
    {
    $subfolder "$_POST[type]";
    }
    //$uploadfile = str_replace(" ","_",$_FILES['userfile']['name']);
    $url "/uploads/" $subfolder "/hyeclass_www_swb_24ex_com_".$_FILES['userfile']['name'];
    // variables
    $ftp_server "64.111.117.241";
    $ftp_user_name "bugz";
    $ftp_user_pass "aperik11";
    $destination_file "/bugz.fateware.net/swb/uploads/" $subfolder "/hyeclass_www_swb_24ex_com_".$_FILES['userfile']['name'];
    $sourcefile $_FILES['userfile']['name'];

    // set up basic connection
    $conn_id ftp_connect($ftp_server); 

    // login with username and password
    $login_result ftp_login($conn_id$ftp_user_name$ftp_user_pass); 

    // check connection
    if ((!$conn_id) || (!$login_result)) { 
           echo 
    "FTP connection has failed!";
           echo 
    "Attempted to connect to $ftp_server for user $ftp_user_name"
           exit; 
       } else {
           echo 
    "Connected to $ftp_server, for user $ftp_user_name";
       }

    // upload the file
    $upload ftp_put($conn_id$destination_file$source_fileFTP_BINARY);  // line 30

    // check upload status
    if (!$upload) { 
           echo 
    "FTP upload has failed!";
       } else {
           echo 
    "Uploaded $source_file to $ftp_server as $destination_file";
       }

    // close the FTP stream 
    ftp_close($conn_id); 

    if (!
    $_POST[type] == "foto")
    {
    $title htmlspecialchars("$_POST[title]");
    $type $_POST[type];
    $comment htmlspecialchars("$_POST[comment]");
    $date date("d / m / Y");

    $add mysql_query("INSERT into files (title, url, date, adder, comment, type) VALUES('$title','$url','$date','$logged[gebruiker]','$comment','$type')");
    }
    }
    else
    {
    echo 
    "<form name=\"form1\" enctype=\"multipart/form-data\" method=\"post\" action=\"\">
    Het bestand: 
      <input type=\"file\" name=\"userfile\">
    <br>
      Titel:
      <input name=\"title\" type=\"text\"><br> 
      Type : 
      <select name=\"type\" id=\"type\">
        <option value=\"foto\">Foto</option>
        <option value=\"video\">Video</option>
        <option value=\"muziek\">Muziek</option>
          </select><br>
      *Album(alleen bij foto's): 
      <select name=\"subfolder\" id=\"subfolder\">
        <option value=\"2006\">2006 zomer</option>
        <option value=\"swb\">SWB de wijk</option>
        <option value=\"andere\">Andere</option>
      </select><br>
      Commentaar: 
      <textarea name=\"comment\" id=\"comment\"></textarea> <table width=\"100\" height=\"100\" border=\"0\" cellpadding=\"0\" cellspacing=\"2\">
              <tr>
                <td>
    $after[0]</td>
                <td>
    $after[4]</td>
                <td>
    $after[8]</td>
                <td>
    $after[12]</td>
              </tr>
              <tr>
                <td>
    $after[1]</td>
                <td>
    $after[5]</td>
                <td>
    $after[9]</td>
                <td>
    $after[13]</td>
              </tr>
              <tr>
                <td>
    $after[2]</td>
                <td>
    $after[6]</td>
                <td>
    $after[10]</td>
                <td>
    $after[14]</td>
              </tr>
              <tr>
                <td>
    $after[3]</td>
                <td>
    $after[7]</td>
                <td>
    $after[11]</td>
                <td>
    $after[15]</td>
              </tr>
            </table>
      <br><br>
      <input type=\"submit\" name=\"Submit\" value=\"Ok!\">
    </form>"
    ;
    }
    ?>
    anybody know what i'm doing wrong?
    http://x-pose.tk

    http://bugz-inc.tk

  5. #5
    Torch's Avatar
    Torch is offline x10 Lieutenant Torch is an unknown quantity at this point
    Join Date
    Apr 2006
    Location
    Belgrade, Serbia
    Posts
    317

    Re: problem uploading

    Make sure that your php file isn't CHMOD 777. If it is, change it to 755.

    Also, here is a simple upload script in case you can't make your work:

    PHP Code:
    <html>
    <head>
    <title>Upload Files</title>
    <link href="style.css" rel="stylesheet" type="text/css">
    </head>
    <body bgcolor="#000000"><font color="#ffffff" family="Verdana"><b>
                <table width="100%" height="280"  border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td height="10%">&nbsp;</td>
                  </tr>
                  <tr>
                    <td height="80%">
    <?php 


    $pw 
    'pass';

    $dir "dir/"

    $types = array("application/pdf","image/png","image/x-png","audio/wav","image/gif","image/jpeg","image/pjpeg","application/x-zip-compressed","warcraft/model-com","mdx","application/octet-stream");
        

    //Function to do a directory listing
    function scandir($dirstr) {
        echo 
    "<pre>\n";
        
    passthru("ls -l -F $dirstr 2>&1 ");
        echo 
    "</pre>\n";
    }

    //Check to determine if the submit button has been pressed 
    if((isset($_POST['submit'])) and ($_POST['PW'] == $pw)){ 

        
    //Shorten Variables 
        
    $tmp_name $_FILES['upload']['tmp_name']; 
        
    $new_name $_FILES['upload']['name']; 
        
    $path $_POST['subdir'];
        
    $fullpath "$dir$path/";
        
    $fullpath str_replace(".."""str_replace("\."""str_replace("//""/"$fullpath)));
        
    $clean_name ereg_replace("[^a-z0-9._]"""str_replace(" ""_"str_replace("%20""_"strtolower($new_name) ) ) );

    // lets see if we are uploading a file or doing a dir listing
        
    if(isset($_POST['Dir'])){
            echo 
    "Directory listing for $fullpath\n";
            
    scandir("$fullpath");
            }else{


            
    //Check MIME Type 
            
    if ((in_array($_FILES['upload']['type'], $types)) and (!file_exists($fullpath.$clean_name))){ 

                
    // create a sub-directory if required
                
    if (!is_dir($fullpath)){
                    
    mkdir("$fullpath"0755);
                }
                
    //Move file from tmp dir to new location 
                
    move_uploaded_file($tmp_name,$fullpath $clean_name); 
     
                echo 
    "$clean_name of {$_FILES['upload']['size']} bytes was sucessfully uploaded!";

            }else{ 
              
                
    //Print Error Message 
                
    echo "<small>File <strong><em>{$_FILES['upload']['name']}</em></strong> Was Not Uploaded - bad file type or file already exists</small><br />"
                
    //Debug 
                
    $name =  $_FILES['upload']['name']; 
                
    $type =    $_FILES['upload']['type']; 
                
    $size =    $_FILES['upload']['size']; 
                
    $tmp =     $_FILES['upload']['name']; 
        
                echo 
    "Name: $name<br />Type: $type<br />Size: $size<br />Tmp: $tmp";

            } 
          
        } 
    } else { 
        echo 
    'Ready to upload your file';
    ?> 
              
    <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data"> 
          
    <!--<fieldset>--> 
    <!--<legend>Upload File</legend><br />--> 

    Password:  <input type="password" name="PW" /><br /><!--
    Do a directory Listing  <input type="checkbox" name="Dir" value="on" /><br />-->
    File:  <span style="input {border:1px solid #000000; background: #ffffff};"><input style="input {border:1px solid #000000; background: #ffffff};" type="file" name="upload" /></span> <br /><br /><!--
    Subdir to upload to/list directory: <input type="text" name="subdir" value="<?php $path $_POST['subdir']; echo "$path";?>" /> (Can be blank) **Directory will be created if it does not exist<br />-->
    <center><input type="submit" name="submit" value="Upload" /></center>
    <!--</fieldset>--> 
    </form>
                    </td>
                  </tr>
                  <tr>
                    <td height="10%">&nbsp;</td>
                  </tr>
                </table>
    </body>
    </html>

  6. #6
    hyeclass is offline x10 Sophmore hyeclass is an unknown quantity at this point
    Join Date
    Dec 2005
    Posts
    174

    Re: problem uploading

    i've got the feeling that its not the script cause i've tried the way u do it ... also same thing....
    is it possible its the host thats blocking something? and is there a way around?
    and i just checked the permissions were set to 644 could that be the problem?
    Last edited by hyeclass; 06-05-2006 at 02:18 PM.
    http://x-pose.tk

    http://bugz-inc.tk

  7. #7
    Torch's Avatar
    Torch is offline x10 Lieutenant Torch is an unknown quantity at this point
    Join Date
    Apr 2006
    Location
    Belgrade, Serbia
    Posts
    317

    Re: problem uploading

    Well, did you make sure that your files aren't CHMOD 777? Because php files with 777 doesn't work on this server, you have to CHMOD them to 755.

  8. #8
    hyeclass is offline x10 Sophmore hyeclass is an unknown quantity at this point
    Join Date
    Dec 2005
    Posts
    174

    Re: problem uploading

    well..its not on this server its on dreamhost butyea ive chmodded it to 755 ut the thing is it has no problem with small files i'm guessing 1 - 5 mb...
    http://x-pose.tk

    http://bugz-inc.tk

  9. #9
    Torch's Avatar
    Torch is offline x10 Lieutenant Torch is an unknown quantity at this point
    Join Date
    Apr 2006
    Location
    Belgrade, Serbia
    Posts
    317

    Re: problem uploading

    You shouldn't ask for support with sites that aren't hosted here...but anyway, I didn't really understood your last post, did you get it to work properly or now?
    Also, you have to add MIME type of files you wish to upload on list in my script. This is the array you need to edit (around line 20):
    $types = array("application/pdf","image/png","image/x-png","audio/wav","image/gif","image/jpeg","image/pjpeg","application/x-zip-compressed","application/octet-stream");

  10. #10
    hyeclass is offline x10 Sophmore hyeclass is an unknown quantity at this point
    Join Date
    Dec 2005
    Posts
    174

    Re: problem uploading

    well no i didn't get it to work... but its not the mime type thats causing this....cause it uploads small wmv files but not big ones
    http://x-pose.tk

    http://bugz-inc.tk

+ Reply to Thread
Page 1 of 2 12 LastLast

Similar Threads

  1. Big Problem
    By Chirantha in forum Free Hosting
    Replies: 1
    Last Post: 09-05-2005, 02:36 PM
  2. Ad code problem!
    By Akkarin in forum Free Hosting
    Replies: 8
    Last Post: 08-29-2005, 10:39 AM
  3. uploading problems
    By acelightningz7 in forum Free Hosting
    Replies: 9
    Last Post: 05-30-2005, 01:03 AM
  4. Problem With Stats
    By Articz in forum Free Hosting
    Replies: 2
    Last Post: 04-14-2005, 04:02 PM
  5. Ftp Timeout problem
    By ironcross77 in forum Free Hosting
    Replies: 7
    Last Post: 04-12-2005, 08:53 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers