Code for uploading pics directly to page

  • DuffMan
  • Beginner
  • Beginner
  • User avatar
  • Posts: 60
  • Loc: Portland, OR

Post 3+ Months Ago

What I want to do: Have my friends upload a picture and a comment through a form and have it displayed instantly on a page on my website. I'd like all the pictures to go on the same page.

If someone can get me the raw code, I can work on the formatting of how its displayed on my own.


Also (Separate but related question), the site is run through my schools servers and there are two ways for me to go about uploading files (when I normally update it.) If I use ftp software, I transfer the files and its instantly ready to be viewed on the internet (like normal). BUT, if I transfer files through the VPN (treating the www folder for all the files like it was on my own computers hard drive) I have to "update permissions" to allow people to see the changes. So what I'm asking is, will this type of transfer be treated like the ftp transfer, or the vpn-type.

The school supports MySQL (if that has anything to do with anything)...

THANKS IN ADVANCE, I KNOW YOU GUYS CAN HELP CAUSE YOUR DAMN GOOD!! :D
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23456
  • Loc: Woodbridge VA

Post 3+ Months Ago

Can't answer based on your info, but you also are good Duffman, so after reading this and realizing it's been here for awhile...have you received error messages? I almost have to assume so. If so what error message/s?
  • Lieven
  • Beginner
  • Beginner
  • User avatar
  • Posts: 57
  • Loc: Belgium

Post 3+ Months Ago

This should be your form:

Code: [ Select ]
<form action="process_pic.php" method="post" ENCTYPE="multipart/form-data">
     <input type="file" name="file"><br>
 <input type="submit">
</form>
  1. <form action="process_pic.php" method="post" ENCTYPE="multipart/form-data">
  2.      <input type="file" name="file"><br>
  3.  <input type="submit">
  4. </form>


this should be your process_pic.php:

Code: [ Select ]
copy($file, "/pictures/".$file_name);


This method still uses the old way of handling form parameters instead of $_FILES but it was just some code i extracted from a project of mine.

To make sure it will work fine, I'd suggest reading http://www.php.net/manual/en/features.file-upload.php

your question about FTP vs. VPN: it's none of the two... it's a HTTP-transfer. The only thing you have to keep in mind is that the user running the webserver (depends of your platform) has write access on your pictures directory. I'd suggest to try it... If you don't have sufficient rights, PHP will complain anyway :P
  • DuffMan
  • Beginner
  • Beginner
  • User avatar
  • Posts: 60
  • Loc: Portland, OR

Post 3+ Months Ago

Thanks Lieven (I'm lovin the santa hat)!!

And Atno, are you asking about errors from the ozzu site or from my own??
  • RichB
  • Guru
  • Guru
  • User avatar
  • Posts: 1121
  • Loc: Boston

Post 3+ Months Ago

I decided to remove the gallery script until I can work on it some more. I have it up and running on my site, and it works ok but clearly needs more features like the ability to show a certain number of images per page and move through the images page by page rather than one big list. I thought of several more things to add too, so I'm going to work on it when I have more time.

In the meantime here is a link to a freeware gallery with way more features than I'm ever going to add.

http://gallery.menalto.com/index.php

Post Information

  • Total Posts in this topic: 5 posts
  • Users browsing this forum: demonmaestro, ScottG and 113 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.