Het probleem is alsvolgt, wanneer ik op uploaden klik en de volgende pagina geopend wordt, zegt hij "You must enter both a description and file"
Terwijl ik dat toch echt gedaan heb.
Dit is de pagina waarin ik de naam en het bestand ingeef;
En dit is de pagina die dat zou moeten bevestigen, alleen krijg ik dus mijn error terug;
En ja, ik weet dat je database traag wordt door er images in te zetten.
Terwijl ik dat toch echt gedaan heb.
Dit is de pagina waarin ik de naam en het bestand ingeef;
PHP:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
| <html> <head> <title> Upload a File </title> </head> <body bgcolor="#FFFFFF"> <form enctype="multipart/form-data" name="frmUploadFile" action="grabfile.php" method="post"> </a> <table border="0" cellpadding="0" cellspacing="0" bordercolor="#111111" width="100%"> <tr> <td width="100%" bgcolor="#FF9900" height="22" colspan="2"> <p style="margin-left: 10"><b><font face="Verdana" size="2" color="#FFFFFF"> Upload a File</font></b></td> </tr> <tr> <td width="100%" bgcolor="#FFE3BB" colspan="2"> <p style="margin-left: 10; margin-right: 10"><font face="Verdana" size="2"> <br>Please select a file from your local computer to upload to our web server for saving in our database. This file can be of any type you like. Once you have chosen a file, please click on the "Upload this file" button below. <br> </font></td> </tr> <tr> <td width="15%" bgcolor="#FFE3BB"> <p style="margin-left: 10"><font face="Verdana" size="2"> File Description:</font></td> <td width="85%" bgcolor="#FFE3BB"> <input type="text" name="strDesc" size="20" maxlength="50"></td> </tr> <tr> <td width="15%" bgcolor="#FFE3BB"> <p style="margin-left: 10"><font face="Verdana" size="2">File Location:</font></td> <td width="85%" bgcolor="#FFE3BB"> <font face="Verdana" size="2"> <input type="file" name="fileUpload" size="20"></font></td> </tr> <tr> <td width="33%" bgcolor="#FFE3BB"> <p style="margin-left: 10"><font face="Verdana" size="2"> <br> <br> </font></td> <td width="67%" bgcolor="#FFE3BB"> <font face="Verdana" size="2"> <input type="submit" value="Upload this file" name="cmdSubmit"></font></td> </tr> </table> </form> </body> </html> |
En dit is de pagina die dat zou moeten bevestigen, alleen krijg ik dus mijn error terug;
PHP:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
| <?php // GrabFile.php: Takes the details // of the new file posted as part // of the form and adds it to the // myBlobs table of our myFiles DB. global $strDesc; global $fileUpload; global $fileUpload_name; global $fileUpload_size; global $fileUpload_type; // Make sure both a description and // file have been entered if(empty($strDesc) || $fileUpload == "none") die("You must enter both a description and file"); $fileHandle = fopen($fileUpload, "r"); $fileContent = fread($fileHandle, $fileUpload_size); $fileContent = addslashes($fileContent); //The connection $db=mysql_connect("localhost", "***", "***") or die (mysql_error()); mysql_select_db('project', $db) or die (mysql_error()); $dbQuery = "INSERT INTO images VALUES "; $dbQuery .= "(0, '$strDesc', '$fileContent', '$fileUpload_type')"; mysql_query($dbQuery) or die("Couldn't add file to database"); echo "<h1>File Uploaded</h1>"; echo "The details of the uploaded file are shown below:<br><br>"; echo "<b>File name:</b> $fileUpload_name <br>"; echo "<b>File type:</b> $fileUpload_type <br>"; echo "<b>File size:</b> $fileUpload_size <br>"; echo "<b>Uploaded to:</b> $fileUpload <br><br>"; echo "<a href='uploadfile.php'>Add Another File</a>"; ?> |
En ja, ik weet dat je database traag wordt door er images in te zetten.