Jump to content

Jzzt

New Members
  • Posts

    1
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Jzzt's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi, first of all I'm dutch so if my english isn't perfect I apologize. Second of all I haven't got much experience with php so my question is probably (and hopefully) easy to answer. Here's the case: in my website I want the webmaster to easily upload pictures and add a discription to them. I have a script that uploads pictures to my webserver and it works. You can see the code below: <form name="form1" method="post" action="" enctype="multipart/form-data"> <input type="file" name="imagefile"> <br> <input type="submit" name="Submit" value="Submit"> <? if(isset($_POST['Submit'])) { //If the Submitbutton was pressed do: if ($_FILES['imagefile']['type']=="image/pjpeg" || $_FILES['imagefile']['type']=="image/gif"){ // MAKE SURE THERE EXIST A FOLDER NAMED 'files' IN THIS PAGE'S CURRENT DIRECTORY // Actually you don't have to supply a folder, it will upload the files to current directory // but for easier and safer file handling, it will be wise to set a separate directory for uploaded files // and this is just an example, you can set '../File/' so that it will jump to another directory altogether. // For Windows users, there will be no problem, but for unix-based users, CHMOD 777 to the upload folder! $imglink = "files/".$_FILES['imagefile']['name']; copy ($_FILES['imagefile']['tmp_name'], $imglink) or die ("Could not copy"); echo "<br>Name: ".$_FILES['imagefile']['name'].""; // the file name+extension echo "<br>Size: ".$_FILES['imagefile']['size']."bytes"; // the size in bytes echo "<br>Type: ".$_FILES['imagefile']['type'].""; // the file type echo "<br><img src=".$imglink." height=50 width=50><br>"; // view the uploaded file/image with fixed height and width } else { echo "<br><br>"; echo "Could Not Copy, Wrong Filetype (".$_FILES['imagefile']['name'].")<br>"; } } ?></form> Now all I need to do is write the filename to a database. I would like to use a ms access database. Can anyone help me please?? Thnx a lot! Jzzt
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.