After PHPnow is installed, the program cannot be used.

Source: Internet
Author: User
The program cannot be used after PHPnow is installed. & nbsp; (2) upload. php & nbsp; --- & nbsp; brief description & nbsp; Upload interface. select a file and submit it to submit. php processing & nbsp; it is worth noting that the program cannot be used after PHPnow is installed.
//////////////////////////////////////// //////////////////////////////
(2) upload. php ---
// Brief description
Upload interface. select a file and submit it to submit. php for processing.
It is worth noting that a hidden VALUE range of MAX_FILE_SIZE can be set
To limit the size of the uploaded file.
// Program source code


File upload form








Method = 'post'>
Select Upload file

Type = 'submit '>




(3) submit. php ---
// Brief description
Save the basic information of uploaded files and files to the database.
// Program source code
If ($ myfile! = "None" & $ myfile! = "") {// Upload a file

// Set the time-out period. The default time is 30 seconds. if the value is set to 0, the time-out period is not limited.
$ Time_limit = 60;
Set_time_limit ($ time_limit );//

// Read the file content to the string
$ Fp = fopen ($ myfile, "rb ");
If (! $ Fp) die ("file open error ");
$ File_data = addslashes (fread ($ fp, filesize ($ myfile )));
Fclose ($ fp );
Unlink ($ myfile );

// File format, name, size
$ File_type = $ myfile_type;
$ File_name = $ myfile_name;
$ File_size = $ myfile_size;

// Connect to the database and save the file to the database
$ Conn = mysql_connect ("127.0.0.1 ","***","***");
If (! $ Conn) die ("error: mysql connect failed ");
Mysql_select_db ("test", $ conn );

$ SQL = "insert into receive
(File_data, file_type, file_name, file_size)
Values ('$ file_data', '$ file_type', '$ file_name', $ file_size )";
$ Result = mysql_query ($ SQL );

// The following sentence retrieves the id of the insert statement.
$ Id = mysql_insert_id ();

Mysql_close ($ conn );

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.