php - Silent failure on move_uploaded_file and ZipArchive::Close -
update/possible solution: i've realized files being moved c:\windows\temp
invisible due file permissions. if try access files via browser, 401 error. believe these files retaining original permissions , unable see them or mess them via php/browser. option change c:\windows\temp
folder permissions or move default_upload_folder within wwwroot
chain.
--
i have iis7 server running php script accepts $_files
, move_uploaded_file
add files directory , zips files using ziparchive
.
both of these statements failing.
here code logic:
ini_set('display_errors',1); if(!empty($_files)){ $tempfile = $_files['filedata']['tmp_name']; $targetpath = 'c:\\inetpub\\wwwroot\\sitename\\design\\uploads\\'; $targetfile = $targetpath.$_files['filedata']['name']; $zip_file = $targetpath . htmlspecialchars($_post['session_id']) . '.zip'; move_uploaded_file($tempfile, $targetfile); $zip = new ziparchive; $res = $zip->open($zip_file, ziparchive::create); $zip->addfile($tempfile, $_files['filedata']['name']); $zip->close(); }
$tempfile
, $targetpath
show having 0777
permissions when check them within script.
move_uploaded_file
shows no error , returns true
, errors if use different directory. appears directory correct. code fails move file new directory. there no error message if use try...catch
.
none of ziparchive
code fails until $zip->close()
, returns false
. there no error message if use try...catch
.
the code worked on wamp test environment. code running script c:\inetpub\wwwroot\sitename\design\uploadify\uploadify.php
.
$_files
has correct data based on var_dump
. $tempfile
resolves c:\windows\temp\php___.tmp
. have feeling may issue lies, don't know how address it.
check if have doc_root
setting in php.ini poinitng proper directory. should specify upload_tmp_dir
(in file uploads
section; subfolder of doc_root
awesome) make sure different system default.
Comments
Post a Comment