haha... my bad... apparently editing an old post to upload a new file doesn't let you... so no here is the new file...

    Looks Good! Thanks alot!
    Only, i am getting these errors...

    Warning: move_uploaded_file(/home/mypage/www/images/69024.gif) [function.move-uploaded-file]: failed to create stream: Permission denied in /home/www/mypage/images/eriksmoen.php on line 84

    Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpYm8B0o' to '/home/mypage/www/images/69024.gif' in /home/www/mypage/images/eriksmoen.php on line 84

    What permissions need to be set?

    Thank-you,
    Sean

      you'll prolly need to chmod 777 images and tmp.... at least images... so since everyone will be able to change the contents of images, make sure they are JUST uploaded images and NOT site images...

        Thanks! one question? where is the file moved to? in step two after it has been verified?

        I can't seem to track it... It doesn't quite make it to the database..

        Thanks for all your help!

          Originally posted by eriksmoen
          haha... my bad... apparently editing an old post to upload a new file doesn't let you... so no here is the new file...

          Do you have error handeling in there if the random variable exisits, I didnt see it.

          What I have done, is pulls the time since the unix Epcoh Date("U") and then adds a random number so you have something like, and then add a random number

          $rand = rand(1,999999);
          $sec = date("U");
          $file = "${sec}${rand}";
          

          that seems to work pretty well, there is such a slight chance of any file having the same name now.

            yep, i planned on doing somthing like that.. i think eriksmoen was just using what he's got for an example.

            Thanks alot for your input! Right now just have to make sure the file gets into the database...

            Thank-you.

              is there somthing in mysql that doesn't like the $image var??

              i am getting this error
              You have an error in your SQL syntax near '©©B%-?£²³´µ¶·‹T@A9YYUÁ=PªÇ©5 ±¸ÎÏÐÑÒ‚LCØÙÚÚ)$GÆÈª% Óåæçè’ÛëìÙ6Gá©7 é÷ø' at line 1
              for this query
              $query = "INSERT INTO files VALUES ('$name','$image')";

              Thanks

                Try

                $query = "INSERT INTO table (column_name_1,column_name_2) VALUES ('$column_value_1','$column_value_2')";
                

                  then i get

                  You have an error in your SQL syntax near ''img_name', 'img_image') VALUES ('50183.gif','GIF89a,d' at line 1
                  for the query
                  $query = "INSERT INTO files('img_name', 'img_image') VALUES ('$name','$image')";

                    what is img_image supposed to contain? you cant start the actual file in an SQL database... you can store refrences to it, the image, if being called locally, still has to be on your server somewhere.

                      if im following the script right, then it should be, and at the point of step two i can see it in the directory, then it disapears when the script moves to step 3

                        it won't let me view the sorce, don't know why but it's hidden?
                        I don't have any scripts or settings changed on my server or personal computer...??

                          7 days later

                          sorry it took so long to reply... the school made us reformat after the semester, so i had to set up everything again...

                          anyhow, "unlink" in step 3 removes the file from the temporary directory

                            5 months later

                            Further to the earlier discussion about using the unix date as the file name, you could make it a little neater by using the original file name with a number, like doc.txt, doc1.txt, doc2.txt etc.

                            Code:

                            				if(file_exists($directory.$original_filename))
                            {	    $path_bits=pathinfo($original_filename);	$name=basename($original_filename,".".$path_bits['extension']);	while(file_exists($directory.$name.$x.".".$path_bits['extension']))
                            {
                            	$x++;
                            }		$final_filename=$name.$x.".".$path_bits['extension'];
                            }
                            
                            This is th code I used for my image upload bit: [url]http://www.astronomyforbeginners.com/yourimages/submitimage.php[/url]
                            
                              Write a Reply...