httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeff Cohen" <apa...@gej-it.com>
Subject RE: [users@httpd] Accessing uploaded files ...
Date Mon, 20 Jan 2003 14:29:08 GMT
First of all make some changes in your Alias directive, it should be look
like that:
Alias /uploads/ /var/www/html/test/clients/uploads

<Directory /var/www/html/test/clients/uploads/>
......
</Directory>

Now, make the changes in your PHP file!
Your PHP file see the web server as you configures it.
PHP should not integrate into your system and get the directories structure,
instead of using the systems directory structure, use the web server Alias
structure as follows: (I mean look how a client will see your web server's
directories structure from the outside, not locally on the machine itself):

/ = document root
/manual/ = a folder under the document root
/uploads/ = an alias under the document root

Think about it, that's what you should put on your PHP file.

All the best,
Jeff Cohen


> -----Original Message-----
> From: Information Services [mailto:is@texasresearchintl.com]
> Sent: Monday, January 20, 2003 9:16 AM
> To: users@httpd.apache.org
> Subject: RE: [users@httpd] Accessing uploaded files ...
> 
> Thanks for the reply. Here is the Virtual Host config file for this web:
> 
> <VirtualHost 67.**.**.**>
> 	DocumentRoot /var/www/html/test
> 	ServerAdmin ***********
> 	ServerName ***.***.com
> 	ServerSignature email
> 	DirectoryIndex default.php index.php index.htm
> 
> # Custom Logs for this host.
> LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"
> %T" combined
> CustomLog logs/test_log combined
> 
> ##Alias
> 
> Alias /var/www/html/test/clients/uploads /home/test/companies
> 
> 
> </VirtualHost>
> 
> I am using PHP to upload the file, which is working fine. The script for
> that is here:
> 
> <?
> function do_file_upload($p_id = "", $c_id="", $userfile="")
> {
> 	// do upload
> 	//echo "doing upload". $userfile;
> 
> 	if (is_uploaded_file($userfile))
> 	{
> 	echo $_FILES['userfile']['name'];
> 	}
> 
> 
> 	if (is_uploaded_file($_FILES['userfile']['tmp_name']))
> 	{
> 
> 	opendir('/home/test/companies/');
> 
> 
> 		move_uploaded_file($_FILES['userfile']['tmp_name'],
> "/home/test/companies/$c_id/reports/" . $_FILES['userfile']['name'])
> 			or die("ERROR_problem uploading the file");
> 
> 	}
> 
> 	db_connect();
> 
> 	$sql = "INSERT INTO test_report (r_name, r_mod_created, r_p_id,
> r_c_id, r_path)
> 			VALUES ('" . $_FILES['userfile']['name'] . "',
NOW(),
> '$p_id', '$c_id', '/clients/uploads/$c_id/reports/' ) ";
> 
> 
> 
> 	$result = mysql_query($sql)
> 		or die("Problem with insert query - $sql ");
> 
> 	echo"
> <script>javascript:document.location.href='index.php';</script>";
> 
> }
> 
> //////////////////////////////////////////////////////////////////////////
> ////////
> ?>
> 
> Let me know if this is too much or too litte information.
> 
> 
> 
> >>> Owen.Boyle@swx.com 01/20/03 03:11AM >>>
> Need more details on this. Please post the config segment that defines
> the alias. How are you doing the upload? Are you using CGI.pm?
> 
> Rgds,
> 
> Owen Boyle
> 
> >-----Original Message-----
> >From: Information Services [mailto:is@texasresearchintl.com]
> >Sent: Samstag, 18. Januar 2003 02:01
> >To: users@httpd.apache.org
> >Subject: [users@httpd] Accessing uploaded files ...
> >
> >
> >OS: RedHat 7.3
> >Apache: 1.3.27
> >
> >We have a virtual host named "server1.domain.com". We have a
> >page where a user can upload files to a DIR that is Aliased
> >outside of the Apache root. The alias is working great and the
> >files actually go to the folder that is outside of the Apache root.
> >
> >BUT
> >
> >When we call the files back using the same Alias we get the
> >CORRECT path but the file doesn't display. e.g:
> >server1.domain.com/dir/file.txt
> >
> >It just gives Error 404.
> >
> >Ideas?
> >
> >
> >---------------------------------------------------------------------
> >The official User-To-User support forum of the Apache HTTP
> >Server Project.
> >See <URL:http://httpd.apache.org/userslist.html> for more info.
> >To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> >   "   from the digest: users-digest-unsubscribe@httpd.apache.org
> >For additional commands, e-mail: users-help@httpd.apache.org
> >
> >
> 
> This message is for the named person's use only. It may contain
> confidential, proprietary or legally privileged information. No
> confidentiality or privilege is waived or lost by any mistransmission.
> If you receive this message in error, please notify the sender urgently
> and then immediately delete the message and any copies of it from your
> system. Please also immediately destroy any hardcopies of the message.
> You must not, directly or indirectly, use, disclose, distribute, print,
> or copy any part of this message if you are not the intended recipient.
> The sender's company reserves the right to monitor all e-mail
> communications through their networks. Any views expressed in this
> message are those of the individual sender, except where the message
> states otherwise and the sender is authorised to state them to be the
> views of the sender's company.
> 
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
> 
> 
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message