prob with uploaded file directory w php and pws

A

Anonymous

Guest
Howdy

I'm trying to build a tool to allow users to store any type of file in a database.

I'm building the prototype on my laptop, running php 4.2.1, and mysql 3.23 something.

Here's the problem.. I've built a simple upload form, with a File input form element. I can't figure out how to correctly set the path in php.ini so that my code can find the uploaded files.

If anyone has insight into this, I'm specifically looking for help with the followoing:

1. What is the default upload directory for Personal Web Server, and can it be changed?

2. How do I correctly format the path to this directory in the php.ini file so that my code can get at these files, including any slashes and dots? (I'm *nix challenged when it comes to file names..)

3. Any other info or insights that might apply would be greatly appreciated.

Thx in advance!
 
I don't know about pws...
But here you are a script that copies a file into a directory as you want.
Maybe it works in the same way...

Code:
if ( !@copy ( $_FILES['your_file']['tmp_name'] , $dir.$new_name_file) ){ //copy the file from your multipart form data form. "your_file" is the name of the field in the form. $dir is the dir where you want it to be copied (relative to the script) and $new_name_file is the definitive name for the file
				echo "<b>".$file." </b> is not copied !!<b><br>";
			}else{
				echo "<b>".$file."</b> is copied !!";
			}
 
Thx for the quick reply, Joan, I do appreciate it.

I've already got a handle on how to process the file once I've got it, I've built and tested that code with files I manually placed into a known directory.

I'm still stuck on letting php know where the uploaded file is, and for that matter, getting the file to upload correctly in the first place.

I think I'm going to have to do some more digging, I might have to set rights on my upload directory, which means I'm going to have to figure out what user the php script engine runs as.

Thx again for your answer!
Hurkle
 
Well,
I think it depends on the temp directory you've chosen here:
$tmp_dir = "./some_dir";
$_FILES['$your_file']['$tmp_dir'];


If you've got the default config in your php_ini, it should work.
http://www.zend.com/manual/configuration.directives.php#ini.upload-tmp-dir
Anyway, If you want you can assign it from php_ini as well.

No further explanations about pws were given in the zend website --->
http://www.zend.com/manual/features.file-upload.php
 
Thx again, Joan!

I figured out what was going on, and where my files were.

The machine I'm prototyping on is a win 98 box w. personal web server, very weak compared to the production environment.

The code snippets I was using as reference were lame, they didn't use the $_FILES['whatever'] format, but something else that wouldn't work right with my setup.

The code that works looks a heck of a lot like what you posted, once again, thx very much for a timely response and your help.

Hurkle
 
Back
Top