Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Htaccess file empty -can't upload files

Status
Not open for further replies.

oneil1

Technical User
Jan 12, 2005
32
0
0
JM
With my previous domain, I was very well able to upload files and photos using a php script to a directory. Upon registering with a new host, I realised that I was no longe rable to do so and the htaccess file was empty. I discovered that this sort of thing is controlled by the htaccess file but I have very little knowledge about it.

How can configure the htaccess file to regain this functionality?
 
It may or may not be a problem with your .htaccess file as file uploads (in your case) will be handled by PHP, not Apache.



Want the best answers? Ask the best questions! TANSTAAFL!
 
But I've tried the same script with a different host and it works quite fine.

Is there anything else that could be hindering me from performing such an action?
 
Again, it's not necessarily your script, and it's not necessarily your .htaccess file.

PHP has a runtime configuration option "file_uploads". If this is set to "off", regardless of your script or Apache settings, you're not going to be able to upload files.

Create a PHP script on your server that consists entirely of:

[tt]<?php
phpinfo();
?>[/tt]

and point your browser to it. The value for "file_uploads" will verify your problem.



Want the best answers? Ask the best questions! TANSTAAFL!
 
Did that sleipnir214. The setting for "file_uploads" is On. Is there anything else I can check for?
 
Hi

oneil1 said:
The setting for "file_uploads" is On. Is there anything else I can check for?
[ul]
[li][tt]upload_tmp_dir[/tt] may point to a directory where you have no write permission[/li]
[li][tt]upload_max_filesize[/tt] may be less then the size of the file you want to upload[/li]
[li][tt]open_basedir[/tt] may point to a directory outside the one where the file is temporary uploaded[/li]
[li][tt]disable_functions[/tt] may list the [tt]move_uploaded_file()[/tt] function[/li]
[/ul]
In which cases the problem & solution would belong to forum434 ( PHP ).
oneil1 said:
I was very well able to upload files and photos using a php script to a directory. Upon registering with a new host, I realised that I was no longe rable to do so
Continuing here or posting in the PHP forum will be pointless until you explain how did you realised you are unable to upload. Error message ? Error log ?

Feherke.
 
Thank for you assistance thus far.
I realized that I was unable to upload because the script justy was not working. The phpinfo() script reveals that my maximum upload file size is 2M, and I saw 2 entries an Error log stating that two of the files I tried to upload exceed that 2Mb (Which is understandable). The other files I try to upload however are well under 1K, and I have not recieved an error message nor error log for these... they just aren't uploading.
 
I neither see them (the files )in the folder that I specified ( $file_dir = "uploads/"; ), nor am I seeing the entry written to the database I set up for each upload to be recorded in.
 
What are you doing with $file_dir that its value would be significant here?

Please keep in mind that of you and all the rest of us, you are the only one who has seen your code.



Want the best answers? Ask the best questions! TANSTAAFL!
 
Sorry I took so long to respond. I'd like to thank you for your assistance. I got through. I wasn't able to respond immediately since I was strapped for time.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top