An error occurred while uploading files. I haven't paid much attention to file upload before. I made a simple task yesterday, but I found many problems. The initial program code is as follows: uploadimg. php (as the current mainstream development language) has not paid much attention to file upload before. yesterday I made a simple one but found many problems.
The initial program code is as follows:
Uploadimg. php (as the mainstream development language)
// Determine whether the upload interface is an implementation interface. if the upload interface is used, the following HTML page is displayed.
If (! $ _ POST [UploadAction]):
?>
// If it is an implementation page, the following HTML page is displayed, and the php (as the mainstream development language) script is activated
Else:
?>
// Www.knowsky.com initializes the UploadAction status
$ UploadAction = 0;
$ UploadFile =$ _ POST [UploadFile];
If ($ UploadFile! = "None") & ($ UploadFile! = ""))
{
$ UploadPath = $ _ SERVER [DOCUMENT_ROOT]. "\";
If (! Is_writeable ($ UploadPath ))
{
Echo "$ UploadPath directory cannot be written! "; Exit;
}
Else
{
Echo "$ UploadPath directory writable! ";
}
$ FileName = $ UploadFile_name;
If ($ UploadFile_size <1024)
{
$ FileSize = (string) $ UploadFile_size. "byte ";
}
Elseif ($ UploadFile_size <(1024*1024 ))
{
$ FileSize = number_format (double) ($ UploadFile_size/1024), 1). "KB ";
}
Else
{
$ FileSize = number_format (double) ($ UploadFile_size/(1024*1024), 1). "KB ";
}
If (! File_exists ($ UploadPath. $ FileName ))
{
If (move_uploaded_file ($ UploadFile, $ UploadPath. $ FileName ))
Bytes. The initial program code is as follows: uploadimg. php (as the mainstream development language )...