0

unlink私がそのように呼ぶとき:
unlink($_FILES['upload_file']['tmp_name']);

次のエラーメッセージが表示されます。
unlink(): No such file or directory in /home/user/public_html/file.php on line 18, referer: http://localhost/file.php

私はその言語に完全に堪能ではないことを知っていますが、http: //www.php.net/manual/en/function.unlink.phpでマニュアルをチェックし、それを正しく使用しているようです。

4

2 に答える 2

1

Why are you trying to unlink an uploaded file? PHP will do it for you when the script handling the upload exits. This is default behavior - unless you take explicit steps to preserve the file, or PHP crashes hard, the uploaded files will ALWAYS be cleaned up for you.

Of course, if you're doing a move_uploaded_file() or similar before you do the unlink, then the temporary file will no longer be there, which is why you're getting this error.

于 2011-08-03T18:31:41.513 に答える
1

存在し$_FILES['upload_file']['tmp_name']ないようです。正しいパスかどうかを確認するために印刷してみてください。

とにかく、tmp ファイルを削除する必要はありません。それらは自動的に削除されます。

于 2011-08-03T18:30:27.393 に答える