问题
I got an exaple of submting images to a submit images to a dB http://www.anyexample.com/programming/php/php_mysql_example__image_gallery_%28blob_storage%29.xml#search This php script above Works really fine when I execute it on MAMP. But when I execute on a PC with XAMPP I just can't get it working gives the 403 error on XAMPP. Checked the php.ini file on the XAMPP installation and read something like short tags = on. Also noticed many people use
<form action="<?php echo htmlentities($_SERVER['PHP_SELF']);?>" method="post"
</form>
insted of
<form action="<?=$PHP_SELF?>" method="POST" enctype="multipart/form-data">
on the example on:http://www.anyexample.com/programming/php/php_mysql_example__image_gallery_%28blob_storage%29.xml#search Any clue to get it working on the PC with XAMPP.
Thanks in advance JPA
回答1:
Error 403 means access violation. Thus you need to check server configuration regarding access to the url contained in $PHP_SELF, file uploading and temporary folder.
As you know when we're submitting multipart/form-data request, PHP tries to store file in temporary folder until script finish its execution. Troubles can occure if server don't have access rights for temporary folder. The other variant is file upload can be totally disabled in PHP configuration.
Check you don't have file_uploads=Off in your php.ini Also check upload_max_filesize and post_max_size, they can forbid your file upload if the filesize is greater than supposed.
来源:https://stackoverflow.com/questions/8411231/form-action-php-self-results-in-error-403