|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Uploading images to a directory
Hello,
I can upload to a BLOB data type and download.... But what I would like to do is upload the file or picture to a directory....How do you do this? Thanks, Attila
__________________
Thanks, Attila http://www.glorynaspiration.com http://www.abitofthings.com |
|
#2
|
|||
|
|||
|
Can somene help with this
Here is what I have worked out so far.
This is not all the code for putting the file name and the location in the database but this is what I am trying to use to upload the file. PHP Code:
I am getting these errors. Warning: Unable to create 'home/Members/attila gna.jpg': No such file or directory in /home/glorynas/public_html/includes/accountadjustsubmit.php on line 16 Warning: Unable to create 'home/Members/': No such file or directory in /home/glorynas/public_html/includes/accountadjustsubmit.php on line 30 Warning: Unable to move '/tmp/phpaT2Qsj' to 'home/Members/' in /home/glorynas/public_html/includes/accountadjustsubmit.php on line 30 |
|
#3
|
|||
|
|||
|
hi there,
This might help u out a bit. first is a html form that lets you search for a file and upload it. <html> <head> <title>Upload a File</title> </head> <body> <h1>Upload a File</h1> <form enctype="multipart/form-data" method="post" action="do_upload.php"> <p><strong>File to Upload:</strong><br> <input type="file" name="your_file" size="30"></p> <P><input type="submit" name="submit" value="Upload File"></p> </form> </body> </html> Second is the php script that takes the file and stores it in your chosen directory. <? if ($_FILES['your_file'] != "") { copy($_FILES['your_file']['tmp_name'], "C:\FoxServ\www\".$_FILES['your_file']['name']) or die("Couldn't copy the file!"); } else { die("No input file specified"); } ?> <html> <head> <title>Successful File Upload!</title> <body> <h1>Success!</h1> <P>You sent: <? echo $_FILES['your_file']['name'] ?>, a <? echo $_FILES['your_file']['size']; ?> byte file with a mime type of <? echo $_FILES['your_file']['type']; ?>.</p> </body> </html> Remember to replace the directory path with the one that matches your settings / chosen file destination! Good luck. Ps. Did you get the blob tutorial working? - if so what web server / php / mysql versions are you running? Gee |
|
#4
|
|||
|
|||
|
Sorry I should have responded sooner...I got my code working thanks for your response though....WIll look at what you put and what I got to streamline the process.
As far as teh blob. I used the tutorial and was able to upload pictures absolutely no problem. But any other file format was garbage. I gave up on it....Perfer to have them go to a directory less Database dependent. If you got a question thought shoot it at me will do my best to help. I am self tought with PHP and MySql ![]() |
|
#5
|
|||
|
|||
|
Hey Attilla,
Any chance of posting your code so I could see it, I am trying to do something similar to what you have been doing and would very much like to see how you tackled the problem! Or you could mail it to me if you prefer. Gee |
|
#6
|
|||
|
|||
|
No problem here you go. This is the page that members fill out.
PHP Code:
This is the page that collects the info and puts what you are looking for the picture into the directory...Mind you I do not care what my members upload. This is jsut for an internet gamming squad....So you might want to add some protection code. If you need help with that let me know. PHP Code:
You can see this lage page here. GnA Roster Page Hope this helps and answers your question....Sorry so Longwinded with the post modiratrs. |
![]() |
| Viewing: Dev Articles Community Forums > Programming > General Programming Help > Uploading images to a directory |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|