Bestand uploaden schijnt te groot te zijn...?
Ik ben alweer een nieuwe site aan het uploaden naar een online host, en deze keer wil ik filmpjes uploaden.
Echter, als ik eentje wil uploaden van 7.7 MB, krijg ik de volgende error:
Code (php)
1
2
3
4
5
2
3
4
5
Request Entity Too Large
The requested resource
/upload.php
does not allow request data with POST requests, or the amount of data provided in the request exceeds the capacity limit.
The requested resource
/upload.php
does not allow request data with POST requests, or the amount of data provided in the request exceeds the capacity limit.
Als ik daarna probeer met een filmpje van 3.6 MB lukt het uploaden wel, maar ook weer niet. Ik bedoel daarmee: het deel na de IF-clause wordt wel uitgevoerd, wat zou betekenen dat de IF succesvol is uitgevoerd. En die IF-clause is de move_uploaded_file command.
Dus: ik krijg wel de melding dat hef ilmpje geupload is, en alles staat ook in de database, maar het bestand zelf is niet geupload.
Daarna probeerde ik met een filmpje van 718 kB (0.7 MB) wat wel succesvol helemaal goed gaat.
Ik heb deze vraag vroeger ook gesteld, en daar ging het wel goed, waar het script hetzelfde is. Enige verschil is: daar hostte ik de site via Apache op mn eigen PC, nu host ik 'm bij een externe host op internet en die heeft waarschijnlijk andere (kleinere) instellingen.
Volgens mij heb ik de vorige keer de tip gekregen om het uploaden via FTP te doen.
Maar ik heb geen flauw idee hoe dat moet.
kan iemand mij uitleggen waarom ik die eerste error krijg, of ik gelijk heb wat betreft de tweede error (en zonee, wat dan wel het probleem is), en/of hoe ik een FTP upload-manier moet maken?
Bedankt!
Code upload.php:
Code (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
50
51
52
53
54
55
56
57
58
59
60
61
62
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
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
include_once('config.php');
session_start();
IF (!isset($_SESSION['Username']))
{ header('Location: '.$homepage); }
IF ($_POST['mode'] == TRUE)
{
$target_path = "uploads/" . basename( $_FILES['uploadedfile']['name']);
function generateRandomString($length=8)
{ $chars = '0123456789abcdefghijklmnopqrstuvwxyz';
$randomString = '';
for ($i = 0; $i < $length; $i++)
{ $randomString .= $chars[rand(0, strlen($chars) - 1)]; }
return $randomString; }
$Path = generateRandomString();
IF (move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path ) )
{
mysql_connect($SQLhost, $SQLuser, $SQLpass) or die('Could not connect: ' . mysql_error());
mysql_select_db($SQLdb) or die('Could not find database: ' . mysql_error());
$id = mysql_result ( mysql_query("SELECT MAX(id) FROM VIDEO"), 0) + 1;
$sql = ("INSERT INTO VIDEO (id, Name, Filename, Path, Madeby, Image, Description, Views, Likes, Dislikes, Day, Month, Year)
VALUES( ".$id.", '".mysql_real_escape_string($_POST['name'])."', '".$_FILES['uploadedfile']['name'] ."', '".$Path."', '".$_SESSION['Username']."', 'play',
'<i>Nog geen beschrijving toegevoegd</i>', 0, 0, 0, '".date(d)."', '".date(m)."', '".date(Y)."') ");
if (!mysql_query($sql)) { die('Query Error: '.mysql_error()); }
header("Location: edit.php?q=".$Path."");
}
ELSE { $control = FALSE; } }
include('header.php');
?>
<html>
<head>
<title>Uploaden!</title>
<link rel="icon" type="image/ico" href="/images/favicon.ico" />
</head>
<body bgcolor="#DFDFDF"><center>
<?php
IF ($_POST['mode'] != TRUE)
{ ECHO "<center><br>
<form enctype='multipart/form-data' action='' method='post'> <table>
<tr> <td width=450 style='text-align: right'> Hoe moet het filmpje gaan heten?</td> <td width=450 style='text-align: left'> <input type='text' name='name' size=25 /></td></tr>
<tr> <td width=450 style='text-align: right'> Selecteer hier het filmpje!</td> <td width=450 style='text-align: left'><input name='uploadedfile' type='file' /></td></tr>
<tr> <td colspan=2 style='text-align: center'> <font color='#FF0000'><h3>LET OP! Het filmpje moet <u>MP4</u> of <u>FLV</u> zijn, en <u>kleiner dan 4 MB</u> !!</h3></font></td> </tr>
<tr> <td colspan=2 style='text-align: center'> <input type='hidden' name='mode' value='TRUE'> <input type='submit' value='Upload Filmpje!' /></td></tr>
</table> </form>"; }
ELSE IF ( ($_POST['mode'] == TRUE) AND ($control == FALSE) )
{ ECHO "<br>Oops, Something went wrong.<br>There was an error uploading the file, please try again!",
"<br><img border='0' src='/images/uhoh.jpeg' alt='Uhoh, something went wrong!' width='650' height='250'>",
"<br><a href='javascript:history.back()';>Klik hier om terug te gaan!</a>"; }
?>
</body>
</html>
include_once('config.php');
session_start();
IF (!isset($_SESSION['Username']))
{ header('Location: '.$homepage); }
IF ($_POST['mode'] == TRUE)
{
$target_path = "uploads/" . basename( $_FILES['uploadedfile']['name']);
function generateRandomString($length=8)
{ $chars = '0123456789abcdefghijklmnopqrstuvwxyz';
$randomString = '';
for ($i = 0; $i < $length; $i++)
{ $randomString .= $chars[rand(0, strlen($chars) - 1)]; }
return $randomString; }
$Path = generateRandomString();
IF (move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path ) )
{
mysql_connect($SQLhost, $SQLuser, $SQLpass) or die('Could not connect: ' . mysql_error());
mysql_select_db($SQLdb) or die('Could not find database: ' . mysql_error());
$id = mysql_result ( mysql_query("SELECT MAX(id) FROM VIDEO"), 0) + 1;
$sql = ("INSERT INTO VIDEO (id, Name, Filename, Path, Madeby, Image, Description, Views, Likes, Dislikes, Day, Month, Year)
VALUES( ".$id.", '".mysql_real_escape_string($_POST['name'])."', '".$_FILES['uploadedfile']['name'] ."', '".$Path."', '".$_SESSION['Username']."', 'play',
'<i>Nog geen beschrijving toegevoegd</i>', 0, 0, 0, '".date(d)."', '".date(m)."', '".date(Y)."') ");
if (!mysql_query($sql)) { die('Query Error: '.mysql_error()); }
header("Location: edit.php?q=".$Path."");
}
ELSE { $control = FALSE; } }
include('header.php');
?>
<html>
<head>
<title>Uploaden!</title>
<link rel="icon" type="image/ico" href="/images/favicon.ico" />
</head>
<body bgcolor="#DFDFDF"><center>
<?php
IF ($_POST['mode'] != TRUE)
{ ECHO "<center><br>
<form enctype='multipart/form-data' action='' method='post'> <table>
<tr> <td width=450 style='text-align: right'> Hoe moet het filmpje gaan heten?</td> <td width=450 style='text-align: left'> <input type='text' name='name' size=25 /></td></tr>
<tr> <td width=450 style='text-align: right'> Selecteer hier het filmpje!</td> <td width=450 style='text-align: left'><input name='uploadedfile' type='file' /></td></tr>
<tr> <td colspan=2 style='text-align: center'> <font color='#FF0000'><h3>LET OP! Het filmpje moet <u>MP4</u> of <u>FLV</u> zijn, en <u>kleiner dan 4 MB</u> !!</h3></font></td> </tr>
<tr> <td colspan=2 style='text-align: center'> <input type='hidden' name='mode' value='TRUE'> <input type='submit' value='Upload Filmpje!' /></td></tr>
</table> </form>"; }
ELSE IF ( ($_POST['mode'] == TRUE) AND ($control == FALSE) )
{ ECHO "<br>Oops, Something went wrong.<br>There was an error uploading the file, please try again!",
"<br><img border='0' src='/images/uhoh.jpeg' alt='Uhoh, something went wrong!' width='650' height='250'>",
"<br><a href='javascript:history.back()';>Klik hier om terug te gaan!</a>"; }
?>
</body>
</html>
Note: ik gebruik de id-query om id+1 te zetten als manier van AUTO_INCREMENT, wat ik ook in de database ingesteld heb. Alleen, het probleem is dat dat niet werkt, en dit werkt op redelijk dezelfde wijze. Ik heb ook geprobeerd om de query in de grote query te zetten, maar dat vond SQL niet leuk. Vandaar deze manier.
Gewijzigd op 19/11/2013 16:51:11 door Kevin Zegikniet
Weet je van php.ini af?
Daar staan instellingen in; onder andere de maximum size van een bestand dat men mag laden.
Als je toegang hebt tot php.ini, kan je dat aanpassen.
Merk op: na het aanpassen van php.ini moet je Apache rebooten.
Aangezien de server niet in eigen bezit is, zal je zo'n dingen waarschijnlijk moeten aanvragen aan je hosting bedrijf.
Maar kan je dit al eens doen:
Dan krijg je een lijst van de ini variabelen.
-------
Kevin Zegikniet op 19/11/2013 16:44:03:
... Note: ik gebruik de id-query om id+1 te zetten als manier van AUTO_INCREMENT, wat ik ook in de database ingesteld heb. Alleen, het probleem is dat dat niet werkt, en dit werkt op redelijk dezelfde wijze. ...
Vertel daar eens meer over. Waarom doe je dit?
Auto Increment werkt goed. Ik zou niet proberen om zelf Auto Increment functionaliteit te maken; dat zou ik afraden.
Laat de DB zijn werk doen.
Gewijzigd op 19/11/2013 17:08:40 door Kris Peeters
Ik weet wat dat zijn inderdaad, alleen kan ik (zoals Kris Peeters ook al zegt) daar niet bij.
In mijn oude ini bestand had ik die ergens bij de 10GB gezet, dus toen kon ik naar hartelust uploaden (naar een 16GB usb, dus daar paste ook wel aardig wat op)
Ik heb nu echter een max van 2GB aan ruimte op het bedrijf, dus dat wordt even wat minder. Maar daar valt prima mee te werken, gezien de site toch puur voor recreatieve purposes is (weet het nederlandse woord even niet).
Kris Peeters
Ik zal eens kijken, wat de waarden zijn die die lijn print.
Toevoeging op 19/11/2013 17:13:02:
Holy shit wat is dat veel! Alstublieft.
Array ( [allow_call_time_pass_reference] => Array ( [global_value] => [local_value] => [access] => 6 ) [allow_url_fopen] => Array ( [global_value] => 1 [local_value] => 1 [access] => 4 ) [allow_url_include] => Array ( [global_value] => [local_value] => [access] => 4 ) [always_populate_raw_post_data] => Array ( [global_value] => 0 [local_value] => 0 [access] => 6 ) [arg_separator.input] => Array ( [global_value] => & [local_value] => & [access] => 6 ) [arg_separator.output] => Array ( [global_value] => & [local_value] => & [access] => 7 ) [asp_tags] => Array ( [global_value] => [local_value] => [access] => 6 ) [assert.active] => Array ( [global_value] => 1 [local_value] => 1 [access] => 7 ) [assert.bail] => Array ( [global_value] => 0 [local_value] => 0 [access] => 7 ) [assert.callback] => Array ( [global_value] => [local_value] => [access] => 7 ) [assert.quiet_eval] => Array ( [global_value] => 0 [local_value] => 0 [access] => 7 ) [assert.warning] => Array ( [global_value] => 1 [local_value] => 1 [access] => 7 ) [auto_append_file] => Array ( [global_value] => /usr/lib/php/foot.php [local_value] => /usr/lib/php/foot.php [access] => 6 ) [auto_detect_line_endings] => Array ( [global_value] => 0 [local_value] => 0 [access] => 7 ) [auto_globals_jit] => Array ( [global_value] => 1 [local_value] => 1 [access] => 6 ) [auto_prepend_file] => Array ( [global_value] => /usr/lib/php/head.php [local_value] => /usr/lib/php/head.php [access] => 6 ) [bcmath.scale] => Array ( [global_value] => 0 [local_value] => 0 [access] => 7 ) [browscap] => Array ( [global_value] => [local_value] => [access] => 4 ) [curl.cainfo] => Array ( [global_value] => [local_value] => [access] => 4 ) [date.default_latitude] => Array ( [global_value] => 31.7667 [local_value] => 31.7667 [access] => 7 ) [date.default_longitude] => Array ( [global_value] => 35.2333 [local_value] => 35.2333 [access] => 7 ) [date.sunrise_zenith] => Array ( [global_value] => 90.583333 [local_value] => 90.583333 [access] => 7 ) [date.sunset_zenith] => Array ( [global_value] => 90.583333 [local_value] => 90.583333 [access] => 7 ) [date.timezone] => Array ( [global_value] => America/New_York [local_value] => America/New_York [access] => 7 ) [default_charset] => Array ( [global_value] => [local_value] => [access] => 7 ) [default_mimetype] => Array ( [global_value] => text/html [local_value] => text/html [access] => 7 ) [default_socket_timeout] => Array ( [global_value] => 60 [local_value] => 60 [access] => 7 ) [define_syslog_variables] => Array ( [global_value] => [local_value] => [access] => 7 ) [disable_classes] => Array ( [global_value] => [local_value] => [access] => 4 ) [disable_functions] => Array ( [global_value] => system, show_source, exec, shell_exec, proc_open, passthru, set_time_limit, ini_restore, mysql_list_dbs, ini_alter, dl, pfsockopen, openlog, syslog, symlink, link, chgrp, leak, popen, escapeshellcmd, apache_child_terminate, apache_get_modules, apache_get_version, apache_getenv, apache_note, apache_setenv, virtual, mb_send_mail [local_value] => system, show_source, exec, shell_exec, proc_open, passthru, set_time_limit, ini_restore, mysql_list_dbs, ini_alter, dl, pfsockopen, openlog, syslog, symlink, link, chgrp, leak, popen, escapeshellcmd, apache_child_terminate, apache_get_modules, apache_get_version, apache_getenv, apache_note, apache_setenv, virtual, mb_send_mail [access] => 4 ) [display_errors] => Array ( [global_value] => 1 [local_value] => 1 [access] => 7 ) [display_startup_errors] => Array ( [global_value] => [local_value] => [access] => 7 ) [doc_root] => Array ( [global_value] => [local_value] => [access] => 4 ) [docref_ext] => Array ( [global_value] => [local_value] => [access] => 7 ) [docref_root] => Array ( [global_value] => [local_value] => [access] => 7 ) [enable_dl] => Array ( [global_value] => [local_value] => [access] => 4 ) [engine] => Array ( [global_value] => 1 [local_value] => 1 [access] => 7 ) [error_append_string] => Array ( [global_value] => [local_value] => [access] => 7 ) [error_log] => Array ( [global_value] => [local_value] => [access] => 7 ) [error_prepend_string] => Array ( [global_value] => [local_value] => [access] => 7 ) [error_reporting] => Array ( [global_value] => 22527 [local_value] => 30711 [access] => 7 ) [exif.decode_jis_intel] => Array ( [global_value] => JIS [local_value] => JIS [access] => 7 ) [exif.decode_jis_motorola] => Array ( [global_value] => JIS [local_value] => JIS [access] => 7 ) [exif.decode_unicode_intel] => Array ( [global_value] => UCS-2LE [local_value] => UCS-2LE [access] => 7 ) [exif.decode_unicode_motorola] => Array ( [global_value] => UCS-2BE [local_value] => UCS-2BE [access] => 7 ) [exif.encode_jis] => Array ( [global_value] => [local_value] => [access] => 7 ) [exif.encode_unicode] => Array ( [global_value] => ISO-8859-15 [local_value] => ISO-8859-15 [access] => 7 ) [exit_on_timeout] => Array ( [global_value] => 0 [local_value] => 0 [access] => 7 ) [expose_php] => Array ( [global_value] => 1 [local_value] => 1 [access] => 4 ) [extension_dir] => Array ( [global_value] => /usr/local/hosting/php-5.3/extensions/ [local_value] => /usr/local/hosting/php-5.3/extensions/ [access] => 4 ) [file_uploads] => Array ( [global_value] => 1 [local_value] => 1 [access] => 4 ) [filter.default] => Array ( [global_value] => unsafe_raw [local_value] => unsafe_raw [access] => 6 ) [filter.default_flags] => Array ( [global_value] => [local_value] => [access] => 6 ) [from] => Array ( [global_value] => [local_value] => [access] => 7 ) [gd.jpeg_ignore_warning] => Array ( [global_value] => 0 [local_value] => 0 [access] => 7 ) [highlight.bg] => Array ( [global_value] => #FFFFFF [local_value] => #FFFFFF [access] => 7 ) [highlight.comment] => Array ( [global_value] => #FF8000 [local_value] => #FF8000 [access] => 7 ) [highlight.default] => Array ( [global_value] => #0000BB [local_value] => #0000BB [access] => 7 ) [highlight.html] => Array ( [global_value] => #000000 [local_value] => #000000 [access] => 7 ) [highlight.keyword] => Array ( [global_value] => #007700 [local_value] => #007700 [access] => 7 ) [highlight.string] => Array ( [global_value] => #DD0000 [local_value] => #DD0000 [access] => 7 ) [html_errors] => Array ( [global_value] => [local_value] => [access] => 7 ) [iconv.input_encoding] => Array ( [global_value] => ISO-8859-1 [local_value] => ISO-8859-1 [access] => 7 ) [iconv.internal_encoding] => Array ( [global_value] => ISO-8859-1 [local_value] => ISO-8859-1 [access] => 7 ) [iconv.output_encoding] => Array ( [global_value] => ISO-8859-1 [local_value] => ISO-8859-1 [access] => 7 ) [ignore_repeated_errors] => Array ( [global_value] => [local_value] => [access] => 7 ) [ignore_repeated_source] => Array ( [global_value] => [local_value] => [access] => 7 ) [ignore_user_abort] => Array ( [global_value] => 0 [local_value] => 0 [access] => 7 ) [implicit_flush] => Array ( [global_value] => [local_value] => [access] => 7 ) [include_path] => Array ( [global_value] => .:/usr/lib/php [local_value] => .:/usr/lib/php [access] => 7 ) [last_modified] => Array ( [global_value] => 0 [local_value] => 0 [access] => 7 ) [log_errors] => Array ( [global_value] => 1 [local_value] => 1 [access] => 7 ) [log_errors_max_len] => Array ( [global_value] => 1024 [local_value] => 1024 [access] => 7 ) [magic_quotes_gpc] => Array ( [global_value] => [local_value] => [access] => 6 ) [magic_quotes_runtime] => Array ( [global_value] => [local_value] => [access] => 7 ) [magic_quotes_sybase] => Array ( [global_value] => [local_value] => [access] => 7 ) [mail.add_x_header] => Array ( [global_value] => 1 [local_value] => 1 [access] => 6 ) [mail.force_extra_parameters] => Array ( [global_value] => [local_value] => [access] => 6 ) [mail.log] => Array ( [global_value] => [local_value] => [access] => 6 ) [max_execution_time] => Array ( [global_value] => 30 [local_value] => 30 [access] => 7 ) [max_file_uploads] => Array ( [global_value] => 20 [local_value] => 20 [access] => 4 ) [max_input_nesting_level] => Array ( [global_value] => 64 [local_value] => 64 [access] => 6 ) [max_input_time] => Array ( [global_value] => 30 [local_value] => 30 [access] => 6 ) [max_input_vars] => Array ( [global_value] => 1000 [local_value] => 1000 [access] => 6 ) [mbstring.detect_order] => Array ( [global_value] => [local_value] => [access] => 7 ) [mbstring.encoding_translation] => Array ( [global_value] => 0 [local_value] => 0 [access] => 6 ) [mbstring.func_overload] => Array ( [global_value] => 0 [local_value] => 0 [access] => 4 ) [mbstring.http_input] => Array ( [global_value] => pass [local_value] => pass [access] => 7 ) [mbstring.http_output] => Array ( [global_value] => pass [local_value] => pass [access] => 7 ) [mbstring.http_output_conv_mimetypes] => Array ( [global_value] => ^(text/|application/xhtml\+xml) [local_value] => ^(text/|application/xhtml\+xml) [access] => 7 ) [mbstring.internal_encoding] => Array ( [global_value] => [local_value] => [access] => 7 ) [mbstring.language] => Array ( [global_value] => neutral [local_value] => neutral [access] => 7 ) [mbstring.strict_detection] => Array ( [global_value] => 0 [local_value] => 0 [access] => 7 ) [mbstring.substitute_character] => Array ( [global_value] => [local_value] => [access] => 7 ) [mcrypt.algorithms_dir] => Array ( [global_value] => [local_value] => [access] => 7 ) [mcrypt.modes_dir] => Array ( [global_value] => [local_value] => [access] => 7 ) [memory_limit] => Array ( [global_value] => 128M [local_value] => 128M [access] => 7 ) [mysql.allow_local_infile] => Array ( [global_value] => 1 [local_value] => 1 [access] => 4 ) [mysql.allow_persistent] => Array ( [global_value] => 1 [local_value] => 1 [access] => 4 ) [mysql.connect_timeout] => Array ( [global_value] => 60 [local_value] => 60 [access] => 7 ) [mysql.default_host] => Array ( [global_value] => [local_value] => [access] => 7 ) [mysql.default_password] => Array ( [global_value] => [local_value] => [access] => 7 ) [mysql.default_port] => Array ( [global_value] => [local_value] => [access] => 7 ) [mysql.default_socket] => Array ( [global_value] => /var/lib/mysql/mysql.sock [local_value] => /var/lib/mysql/mysql.sock [access] => 7 ) [mysql.default_user] => Array ( [global_value] => [local_value] => [access] => 7 ) [mysql.max_links] => Array ( [global_value] => -1 [local_value] => -1 [access] => 4 ) [mysql.max_persistent] => Array ( [global_value] => -1 [local_value] => -1 [access] => 4 ) [mysql.trace_mode] => Array ( [global_value] => [local_value] => [access] => 7 ) [mysqli.allow_local_infile] => Array ( [global_value] => 1 [local_value] => 1 [access] => 4 ) [mysqli.allow_persistent] => Array ( [global_value] => 1 [local_value] => 1 [access] => 4 ) [mysqli.default_host] => Array ( [global_value] => [local_value] => [access] => 7 ) [mysqli.default_port] => Array ( [global_value] => 3306 [local_value] => 3306 [access] => 7 ) [mysqli.default_pw] => Array ( [global_value] => [local_value] => [access] => 7 ) [mysqli.default_socket] => Array ( [global_value] => [local_value] => [access] => 7 ) [mysqli.default_user] => Array ( [global_value] => [local_value] => [access] => 7 ) [mysqli.max_links] => Array ( [global_value] => -1 [local_value] => -1 [access] => 4 ) [mysqli.max_persistent] => Array ( [global_value] => -1 [local_value] => -1 [access] => 4 ) [mysqli.reconnect] => Array ( [global_value] => [local_value] => [access] => 4 ) [open_basedir] => Array ( [global_value] => /home/u968872759:/usr/lib/php:/tmp [local_value] => /home/u968872759:/usr/lib/php:/tmp [access] => 4 ) [output_buffering] => Array ( [global_value] => 4096 [local_value] => 4096 [access] => 6 ) [output_handler] => Array ( [global_value] => [local_value] => [access] => 6 ) [pcre.backtrack_limit] => Array ( [global_value] => 1000000 [local_value] => 1000000 [access] => 7 ) [pcre.recursion_limit] => Array ( [global_value] => 100000 [local_value] => 100000 [access] => 7 ) [pdo_mysql.default_socket] => Array ( [global_value] => /var/lib/mysql/mysql.sock [local_value] => /var/lib/mysql/mysql.sock [access] => 4 ) [phar.cache_list] => Array ( [global_value] => [local_value] => [access] => 4 ) [phar.readonly] => Array ( [global_value] => 1 [local_value] => 1 [access] => 7 ) [phar.require_hash] => Array ( [global_value] => 1 [local_value] => 1 [access] => 7 ) [phpd] => Array ( [global_value] => 1 [local_value] => 1 [access] => 7 ) [phpd.t] => Array ( [global_value] => 1 [local_value] => 1 [access] => 7 ) [post_max_size] => Array ( [global_value] => 8M [local_value] => 8M [access] => 6 ) [precision] => Array ( [global_value] => 14 [local_value] => 14 [access] => 7 ) [realpath_cache_size] => Array ( [global_value] => 16K [local_value] => 16K [access] => 4 ) [realpath_cache_ttl] => Array ( [global_value] => 120 [local_value] => 120 [access] => 4 ) [register_argc_argv] => Array ( [global_value] => [local_value] => [access] => 6 ) [register_globals] => Array ( [global_value] => [local_value] => [access] => 6 ) [register_long_arrays] => Array ( [global_value] => [local_value] => [access] => 6 ) [report_memleaks] => Array ( [global_value] => 1 [local_value] => 1 [access] => 7 ) [report_zend_debug] => Array ( [global_value] => 1 [local_value] => 1 [access] => 7 ) [request_order] => Array ( [global_value] => GP [local_value] => GP [access] => 6 ) [safe_mode] => Array ( [global_value] => [local_value] => [access] => 4 ) [safe_mode_allowed_env_vars] => Array ( [global_value] => PHP_ [local_value] => PHP_ [access] => 4 ) [safe_mode_exec_dir] => Array ( [global_value] => [local_value] => [access] => 4 ) [safe_mode_gid] => Array ( [global_value] => [local_value] => [access] => 4 ) [safe_mode_include_dir] => Array ( [global_value] => [local_value] => [access] => 4 ) [safe_mode_protected_env_vars] => Array ( [global_value] => LD_LIBRARY_PATH [local_value] => LD_LIBRARY_PATH [access] => 4 ) [sendmail_from] => Array ( [global_value] => [local_value] => [access] => 7 ) [sendmail_path] => Array ( [global_value] => /usr/local/hosting/bin/phpsendmail [local_value] => /usr/local/hosting/bin/phpsendmail [access] => 4 ) [serialize_precision] => Array ( [global_value] => 17 [local_value] => 17 [access] => 7 ) [session.auto_start] => Array ( [global_value] => 0 [local_value] => 0 [access] => 7 ) [session.bug_compat_42] => Array ( [global_value] => [local_value] => [access] => 7 ) [session.bug_compat_warn] => Array ( [global_value] => [local_value] => [access] => 7 ) [session.cache_expire] => Array ( [global_value] => 180 [local_value] => 180 [access] => 7 ) [session.cache_limiter] => Array ( [global_value] => nocache [local_value] => nocache [access] => 7 ) [session.cookie_domain] => Array ( [global_value] => [local_value] => [access] => 7 ) [session.cookie_httponly] => Array ( [global_value] => [local_value] => [access] => 7 ) [session.cookie_lifetime] => Array ( [global_value] => 0 [local_value] => 0 [access] => 7 ) [session.cookie_path] => Array ( [global_value] => / [local_value] => / [access] => 7 ) [session.cookie_secure] => Array ( [global_value] => [local_value] => [access] => 7 ) [session.entropy_file] => Array ( [global_value] => [local_value] => [access] => 7 ) [session.entropy_length] => Array ( [global_value] => 0 [local_value] => 0 [access] => 7 ) [session.gc_divisor] => Array ( [global_value] => 1000 [local_value] => 1000 [access] => 7 ) [session.gc_maxlifetime] => Array ( [global_value] => 1440 [local_value] => 1440 [access] => 7 ) [session.gc_probability] => Array ( [global_value] => 1 [local_value] => 1 [access] => 7 ) [session.hash_bits_per_character] => Array ( [global_value] => 5 [local_value] => 5 [access] => 7 ) [session.hash_function] => Array ( [global_value] => 0 [local_value] => 0 [access] => 7 ) [session.name] => Array ( [global_value] => PHPSESSID [local_value] => PHPSESSID [access] => 7 ) [session.referer_check] => Array ( [global_value] => [local_value] => [access] => 7 ) [session.save_handler] => Array ( [global_value] => files [local_value] => files [access] => 7 ) [session.save_path] => Array ( [global_value] => /tmp [local_value] => /tmp [access] => 7 ) [session.serialize_handler] => Array ( [global_value] => php [local_value] => php [access] => 7 ) [session.use_cookies] => Array ( [global_value] => 1 [local_value] => 1 [access] => 7 ) [session.use_only_cookies] => Array ( [global_value] => 1 [local_value] => 1 [access] => 7 ) [session.use_trans_sid] => Array ( [global_value] => 0 [local_value] => 0 [access] => 7 ) [short_open_tag] => Array ( [global_value] => 1 [local_value] => 1 [access] => 6 ) [SMTP] => Array ( [global_value] => localhost [local_value] => localhost [access] => 7 ) [smtp_port] => Array ( [global_value] => 25 [local_value] => 25 [access] => 7 ) [soap.wsdl_cache] => Array ( [global_value] => 1 [local_value] => 1 [access] => 7 ) [soap.wsdl_cache_dir] => Array ( [global_value] => /tmp [local_value] => /tmp [access] => 7 ) [soap.wsdl_cache_enabled] => Array ( [global_value] => 1 [local_value] => 1 [access] => 7 ) [soap.wsdl_cache_limit] => Array ( [global_value] => 5 [local_value] => 5 [access] => 7 ) [soap.wsdl_cache_ttl] => Array ( [global_value] => 86400 [local_value] => 86400 [access] => 7 ) [sql.safe_mode] => Array ( [global_value] => [local_value] => [access] => 4 ) [sqlite.assoc_case] => Array ( [global_value] => 0 [local_value] => 0 [access] => 7 ) [sqlite3.extension_dir] => Array ( [global_value] => [local_value] => [access] => 4 ) [track_errors] => Array ( [global_value] => [local_value] => [access] => 7 ) [unserialize_callback_func] => Array ( [global_value] => [local_value] => [access] => 7 ) [upload_max_filesize] => Array ( [global_value] => 8M [local_value] => 8M [access] => 6 ) [upload_tmp_dir] => Array ( [global_value] => /tmp [local_value] => /tmp [access] => 4 ) [url_rewriter.tags] => Array ( [global_value] => a=href,area=href,frame=src,input=src,form=fakeentry [local_value] => a=href,area=href,frame=src,input=src,form=fakeentry [access] => 7 ) [user_agent] => Array ( [global_value] => [local_value] => [access] => 7 ) [user_dir] => Array ( [global_value] => [local_value] => [access] => 4 ) [user_ini.cache_ttl] => Array ( [global_value] => 300 [local_value] => 300 [access] => 4 ) [user_ini.filename] => Array ( [global_value] => .user.ini [local_value] => .user.ini [access] => 4 ) [variables_order] => Array ( [global_value] => GPCS [local_value] => GPCS [access] => 6 ) [xbithack] => Array ( [global_value] => 0 [local_value] => 0 [access] => 7 ) [xmlrpc_error_number] => Array ( [global_value] => 0 [local_value] => 0 [access] => 7 ) [xmlrpc_errors] => Array ( [global_value] => 0 [local_value] => 0 [access] => 4 ) [xsl.security_prefs] => Array ( [global_value] => 44 [local_value] => 44 [access] => 7 ) [y2k_compliance] => Array ( [global_value] => 1 [local_value] => 1 [access] => 7 ) [zend.enable_gc] => Array ( [global_value] => 1 [local_value] => 1 [access] => 7 ) [zlib.output_compression] => Array ( [global_value] => [local_value] => [access] => 7 ) [zlib.output_compression_level] => Array ( [global_value] => -1 [local_value] => -1 [access] => 7 ) [zlib.output_handler] => Array ( [global_value] => [local_value] => [access] => 7 ) ) Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/u968872759/public_html/index.php:3) in /home/u968872759/public_html/config.php on line 2
Gewijzigd op 19/11/2013 17:13:30 door Kevin Zegikniet
Ja, je ziet dat die op zowat 8 MB staan). Een beetje meer zou fijn zijn.
En dan nog zou dat geen problemen moeten opleveren met 7.7 MB of 3.6 MB... ?
EDIT: ik heb 'm gevonden!
Toevoeging op 20/11/2013 08:21:46:
Kan het trouwens ook aan een tijdslimiet liggen? Ik zie namelijk bij "max execution time" en ook bij "max input time" het getal 30 staan...?
Gewijzigd op 20/11/2013 08:23:11 door Kevin Zegikniet
Dat is 30 seconden.
- SanThe - op 20/11/2013 08:35:42:
Dat meen je niet! ;)Dat is 30 seconden.
Heb het zonet geprobeerd met een filmpje van 10MB, en die uploadt perfect tot 99% (duurde 1.5 minuut), en bij de 100ste % krijg ik weer de melding van beginpost te zien: te groot bestand. Wat ook prima logisch is.
Nu is mijn vraag dus: hoe moet ik dat met FTP doen? (als dat uberhaupt kan?)
Gewijzigd op 20/11/2013 11:16:36 door Kevin Zegikniet
https://filezilla-project.org/
Let op dat je de client download en niet de server!
Uitgaande van Filezilla (maar moet je bij de anderen ook) moet je nu 4 gegevens invullen:
1. host
2. username
3. password
4. port
Host is zoiets als: ftp.jouwdomein.nl. Username en password spreken voor zich en port is 21 (FTP protocol luistert standaard op poort 21).
Als je nu connecteert en connectie is gelukt zie je aan de re kant de root met eventuele mappen en bestanden van de webserver. De li kant is jouw eigen pc.
Als de connectie niet lukt moet je even bovenaan in de logging kijken, het kan zijn dat je even moet stoeien met de passive en active mode.
meer hierover kun je hier lezen: http://support.tigertech.net/filezilla-passive
Uploaden via FTP is idd het meest logische. Daartvoor heb je eerst een client nodig om de verbinding op te zetten. Filezilla is freeware en wordt veel gebruikt: Let op dat je de client download en niet de server!
Uitgaande van Filezilla (maar moet je bij de anderen ook) moet je nu 4 gegevens invullen:
1. host
2. username
3. password
4. port
Host is zoiets als: ftp.jouwdomein.nl. Username en password spreken voor zich en port is 21 (FTP protocol luistert standaard op poort 21).
Als je nu connecteert en connectie is gelukt zie je aan de re kant de root met eventuele mappen en bestanden van de webserver. De li kant is jouw eigen pc.
Als de connectie niet lukt moet je even bovenaan in de logging kijken, het kan zijn dat je even moet stoeien met de passive en active mode.
meer hierover kun je hier lezen: http://support.tigertech.net/filezilla-passive
Dat heb ik al voor elkaar, alleen wil ik dus via een phpscript uploaden
Ik heb al een scriptje, maar dat wil nu ineens niet inloggen... post vanmiddag de code + errors wel.
Gewijzigd op 21/11/2013 08:21:48 door Kevin Zegikniet
Kevin Zegikniet op 21/11/2013 08:20:04:
Jack
Dat heb ik al voor elkaar, alleen wil ik dus via een phpscript uploaden
Ik heb al een scriptje, maar dat wil nu ineens niet inloggen... post vanmiddag de code + errors wel.
Dat heb ik al voor elkaar, alleen wil ik dus via een phpscript uploaden
Ik heb al een scriptje, maar dat wil nu ineens niet inloggen... post vanmiddag de code + errors wel.
De middag is bijna voorbij :)
Het is niet heel moeilijk om een bestand te uploaden via ftp met php
Je kunt vervolgens een ajax request doen zodat de download lekker in de achtergrond door loopt en jij vervolgens verder kan of je browser vast kan sluiten.
Het volgende voorbeeld loopt hier prima.
Code (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
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
<link rel="stylesheet" href="styles.css" type="text/css">
<style type="text/css">
</style>
</head>
<body>
<div id="status"><button>Start Upload</button></div>
<script>
$(document).ready(function() {
$('button').click(function() {
$('#status').html('<img src="spinner.gif" />');
$.get( "ftp.request.php", {} )
.done(function( data ) {
$('#status').html('Geupload' + data);
});
});
});
</script>
</body>
</html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
<link rel="stylesheet" href="styles.css" type="text/css">
<style type="text/css">
</style>
</head>
<body>
<div id="status"><button>Start Upload</button></div>
<script>
$(document).ready(function() {
$('button').click(function() {
$('#status').html('<img src="spinner.gif" />');
$.get( "ftp.request.php", {} )
.done(function( data ) {
$('#status').html('Geupload' + data);
});
});
});
</script>
</body>
</html>
ftp.request.php
Code (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
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
<?php
function ftpupload($file) {
$ftp_server = '';
$ftp_user_name = '';
$ftp_user_pass '';
$dir = '/volledige pad naar je bestemming/';
$fileparts = pathinfo($file);
//$filename = $fileparts['basename'];
$ext = $fileparts['extension'];
$filename = uniqid('upload_') . date('YmdHi') . '.' . $ext;
$conn_id = ftp_connect($ftp_server);
if(ftp_login($conn_id, $ftp_user_name, $ftp_user_pass)){
if(ftp_put($conn_id, $dir.$filename, $file, FTP_BINARY)){// FTP_ASCII for text files || FTP_BINARY
echo '<p>'.$filename.' is succesvol geupload</p>'.PHP_EOL;
} else {
echo '<p>Upload '.$filename.' is mislukt</p>'.PHP_EOL;
}
} else {
echo '<p>Verbinding met FTP server is mislukt</p>'.PHP_EOL;
}
ftp_close($conn_id);
}
/*
http://www.bbned.nl/scripts/speedtest/download/file32mb.bin
http://www.bbned.nl/scripts/speedtest/download/file100mb.bin
http://www.bbned.nl/scripts/speedtest/download/file1000mb.bin
*/
ftpupload('http://www.bbned.nl/scripts/speedtest/download/file100mb.bin');
?>
function ftpupload($file) {
$ftp_server = '';
$ftp_user_name = '';
$ftp_user_pass '';
$dir = '/volledige pad naar je bestemming/';
$fileparts = pathinfo($file);
//$filename = $fileparts['basename'];
$ext = $fileparts['extension'];
$filename = uniqid('upload_') . date('YmdHi') . '.' . $ext;
$conn_id = ftp_connect($ftp_server);
if(ftp_login($conn_id, $ftp_user_name, $ftp_user_pass)){
if(ftp_put($conn_id, $dir.$filename, $file, FTP_BINARY)){// FTP_ASCII for text files || FTP_BINARY
echo '<p>'.$filename.' is succesvol geupload</p>'.PHP_EOL;
} else {
echo '<p>Upload '.$filename.' is mislukt</p>'.PHP_EOL;
}
} else {
echo '<p>Verbinding met FTP server is mislukt</p>'.PHP_EOL;
}
ftp_close($conn_id);
}
/*
http://www.bbned.nl/scripts/speedtest/download/file32mb.bin
http://www.bbned.nl/scripts/speedtest/download/file100mb.bin
http://www.bbned.nl/scripts/speedtest/download/file1000mb.bin
*/
ftpupload('http://www.bbned.nl/scripts/speedtest/download/file100mb.bin');
?>
De file1000mb.bin gaat hier zonder problemen.
Code (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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
include_once('config.php');
session_start();
IF (!isset($_SESSION['Username']))
{ header('Location: '.$homepage); }
IF ($_POST['mode'] == TRUE)
{
function generateRandomString($length=8)
{ $chars = '0123456789abcdefghijklmnopqrstuvwxyz';
$randomString = '';
for ($i = 0; $i < $length; $i++)
{ $randomString .= $chars[rand(0, strlen($chars) - 1)]; }
return $randomString; }
$Path = generateRandomString();
#$target_path = "uploads/" . basename( $_FILES['uploadedfile']['name']);
#IF ( move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path ) )
$fcon = ftp_connect($FTPserver);
$flogin = ftp_login($fcon, $FTPuser, $FTPpass);
IF (ftp_put($fcon, $_FILES['uploadedfile']['name'], "uploads/".$_FILES['uploadedfile']['name'], FTP_BINARY) )
{
mysql_connect($SQLhost, $SQLuser, $SQLpass) or die('Could not connect: ' . mysql_error());
mysql_select_db($SQLdb) or die('Could not find database: ' . mysql_error());
$id = mysql_result ( mysql_query("SELECT MAX(id) FROM VIDEO"), 0) + 1;
$sql = ("INSERT INTO VIDEO (id, Name, Filename, Path, Madeby, Image, Description, Views, Likes, Dislikes, Day, Month, Year)
VALUES( ".$id.", '".mysql_real_escape_string($_POST['name'])."', '".$_FILES['uploadedfile']['name'] ."', '".$Path."', '".$_SESSION['Username']."', 'play.png',
'<i>Nog geen beschrijving toegevoegd</i>', 0, 0, 0, '".date(d)."', '".date(m)."', '".date(Y)."') ");
if (!mysql_query($sql)) { die('Query Error: '.mysql_error()); }
ftp_close($fcon);
header("Location: edit.php?q=".$Path."");
}
ELSE { $control = FALSE; } }
ftp_close($fcon);
include('header.php');
?>
<html>
<head>
<title>Uploaden!</title>
<link rel="icon" type="image/ico" href="/images/favicon.ico" />
</head>
<body bgcolor="#DFDFDF"><center>
<?php
IF ($_POST['mode'] != TRUE)
{ ECHO "<center><br>
<form enctype='multipart/form-data' action='' method='post'> <table>
<tr> <td width=450 style='text-align: right'> Hoe moet het filmpje gaan heten?</td> <td width=450 style='text-align: left'> <input type='text' name='name' size=25 /></td></tr>
<tr> <td width=450 style='text-align: right'> Selecteer hier het filmpje!</td> <td width=450 style='text-align: left'><input name='uploadedfile' type='file' /></td></tr>
<tr> <td colspan=2 style='text-align: center'> <font color='#FF0000'><h3>LET OP! Het filmpje moet <u>MP4</u> of <u>FLV</u> zijn, en <u>kleiner dan 4 MB</u> !!</h3></font></td> </tr>
<tr> <td colspan=2 style='text-align: center'> <input type='hidden' name='mode' value='TRUE'> <input type='submit' value='Upload Filmpje!' /></td></tr>
</table> </form>"; }
ELSE IF ( ($_POST['mode'] == TRUE) AND ($control == FALSE) )
{ ECHO "<br>Oops, Something went wrong.<br>There was an error uploading the file, please try again!",
"<br><a href='javascript:history.back()';><img border='0' src='/images/uhoh.jpeg' alt='Uhoh, something went wrong!' width='650' height='250'>",
"<br>Klik hier om terug te gaan!</a>"; }
?>
</body>
</html>
include_once('config.php');
session_start();
IF (!isset($_SESSION['Username']))
{ header('Location: '.$homepage); }
IF ($_POST['mode'] == TRUE)
{
function generateRandomString($length=8)
{ $chars = '0123456789abcdefghijklmnopqrstuvwxyz';
$randomString = '';
for ($i = 0; $i < $length; $i++)
{ $randomString .= $chars[rand(0, strlen($chars) - 1)]; }
return $randomString; }
$Path = generateRandomString();
#$target_path = "uploads/" . basename( $_FILES['uploadedfile']['name']);
#IF ( move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path ) )
$fcon = ftp_connect($FTPserver);
$flogin = ftp_login($fcon, $FTPuser, $FTPpass);
IF (ftp_put($fcon, $_FILES['uploadedfile']['name'], "uploads/".$_FILES['uploadedfile']['name'], FTP_BINARY) )
{
mysql_connect($SQLhost, $SQLuser, $SQLpass) or die('Could not connect: ' . mysql_error());
mysql_select_db($SQLdb) or die('Could not find database: ' . mysql_error());
$id = mysql_result ( mysql_query("SELECT MAX(id) FROM VIDEO"), 0) + 1;
$sql = ("INSERT INTO VIDEO (id, Name, Filename, Path, Madeby, Image, Description, Views, Likes, Dislikes, Day, Month, Year)
VALUES( ".$id.", '".mysql_real_escape_string($_POST['name'])."', '".$_FILES['uploadedfile']['name'] ."', '".$Path."', '".$_SESSION['Username']."', 'play.png',
'<i>Nog geen beschrijving toegevoegd</i>', 0, 0, 0, '".date(d)."', '".date(m)."', '".date(Y)."') ");
if (!mysql_query($sql)) { die('Query Error: '.mysql_error()); }
ftp_close($fcon);
header("Location: edit.php?q=".$Path."");
}
ELSE { $control = FALSE; } }
ftp_close($fcon);
include('header.php');
?>
<html>
<head>
<title>Uploaden!</title>
<link rel="icon" type="image/ico" href="/images/favicon.ico" />
</head>
<body bgcolor="#DFDFDF"><center>
<?php
IF ($_POST['mode'] != TRUE)
{ ECHO "<center><br>
<form enctype='multipart/form-data' action='' method='post'> <table>
<tr> <td width=450 style='text-align: right'> Hoe moet het filmpje gaan heten?</td> <td width=450 style='text-align: left'> <input type='text' name='name' size=25 /></td></tr>
<tr> <td width=450 style='text-align: right'> Selecteer hier het filmpje!</td> <td width=450 style='text-align: left'><input name='uploadedfile' type='file' /></td></tr>
<tr> <td colspan=2 style='text-align: center'> <font color='#FF0000'><h3>LET OP! Het filmpje moet <u>MP4</u> of <u>FLV</u> zijn, en <u>kleiner dan 4 MB</u> !!</h3></font></td> </tr>
<tr> <td colspan=2 style='text-align: center'> <input type='hidden' name='mode' value='TRUE'> <input type='submit' value='Upload Filmpje!' /></td></tr>
</table> </form>"; }
ELSE IF ( ($_POST['mode'] == TRUE) AND ($control == FALSE) )
{ ECHO "<br>Oops, Something went wrong.<br>There was an error uploading the file, please try again!",
"<br><a href='javascript:history.back()';><img border='0' src='/images/uhoh.jpeg' alt='Uhoh, something went wrong!' width='650' height='250'>",
"<br>Klik hier om terug te gaan!</a>"; }
?>
</body>
</html>
Ik krijg een error bij het inloggen:
Code (php)
1
Warning: ftp_login(): Login authentication failed in /home/u968872759/public_html/upload.php on line 22
en bij het uploaden zelf:
Kevin Zegikniet op 21/11/2013 15:50:17:
Ik krijg een error bij het inloggen:
en bij het uploaden zelf:
Code (php)
1
Warning: ftp_login(): Login authentication failed in /home/u968872759/public_html/upload.php on line 22
en bij het uploaden zelf:
Die eerste melding zegt dat je niet bent ingelogd.
Waarschijnlijk heb je dus geen of foutieve inloggegevens mee gegeven
$FTPserver $FTPuser $FTPpass staan in je config?
Die tweede melding is dan een logisch vervolg.
Toevoeging op 21/11/2013 16:09:22:
Ik zie het al. Ik krijg een nummer als inlognaam ,en ik heb twee nummers omgewisseld *facepalm*
Toevoeging op 21/11/2013 16:11:46:
EDIT: nu werkt het, ik krijg de melding van inloggen niet meer.
Tweede melding is er echter nog wel,. precies hetzelfde.
Ligt dat 'm niet aan de command, dat ik ipv ftp_put dus ftp_fput oid moet gebruiken?
dat lag volgens mij aan 'open file' ofzo, en ik heb geen flauw idee wat dat nou precies inhoudt.
Toevoeging op 21/11/2013 16:15:59:
Nu probeer ik het met een .3gp van 3.5 Mb, en krijg ik geen errors, maar ook uberhaupt niks: wit scherm...
Ik zal de session_start ook even boven je include zetten.
Misschien helpt het om FTP_BINARY in de ftp_put mee te geven, zie mijn voorbeeld.
Edit:
Ook zal ik die "uploads/".$_FILES['uploadedfile']['name'] veranderen in je volledige pad. Log hiervoor in op je FTP en kijk welke mappen je door moet om bij uploads te komen.
Bijvoorbeeld /domains/jouwebsite/htdocs/www/uploads/ (in mijn geval)
Ook zal ik die "uploads/".$_FILES['uploadedfile']['name'] veranderen in je volledige pad. Log hiervoor in op je FTP en kijk welke mappen je door moet om bij uploads te komen.
Bijvoorbeeld /domains/jouwebsite/htdocs/www/uploads/ (in mijn geval)
Gewijzigd op 21/11/2013 16:27:58 door Michael -
Code (php)
1
2
3
4
2
3
4
Notice: Undefined index: mode in /home/u968872759/public_html/upload.php on line 10
Notice: A session had already been started - ignoring session_start() in /home/u968872759/public_html/header.php on line 2
Notice: Undefined index: s in /home/u968872759/public_html/header.php on line 8
Notice: Undefined index: p in /home/u968872759/public_html/header.php on line 9
Notice: A session had already been started - ignoring session_start() in /home/u968872759/public_html/header.php on line 2
Notice: Undefined index: s in /home/u968872759/public_html/header.php on line 8
Notice: Undefined index: p in /home/u968872759/public_html/header.php on line 9
In header staat inderdaad ook al session_start, evenals in config.
S en P zijn idd niet geset, omdat die get-variabelen zijn. daarmee kun je naar search en profile gaan, om resp filmpjes - users te zoeken.
en dan krijg ik deze logischerwijze ook:
Omdat die nog niet is geset, wat namelijk gebeurt in het stukje erna.
Also, ik heb het pad veranderd in de volledige ding:
Waar ik vanav /Public... in filezilla kan zien, en dat u-nummer is mijn usernummer op het hostingbedrijfding
Oh, en FTP_BINARY staat in de ding. Scroll ff naar rechts en voila
Gewijzigd op 21/11/2013 21:30:35 door Kevin Zegikniet
Welk verschil denken jullie dat het maakt ...........
Ik zie nog steeds een $_FILES in het script, dus is het nog steeds http post request en blijf je dezelfde beperkingen houden.
Er wordt hier nog al eens neerbuigend over Flash gedaan, maar daarmee heb je wel de mogelijkheid om in je browser een FTP client te maken.
Ook zou je nog een Java Applet kunnen maken.
En wie weet is het al voor je gedaan.
Ik zal van't weekend er eens naar kijken, het ziet er namelijk niet erg bekend uit voor mij dat eerste stukje.
Ik ben trouwens ook bezig om een domeinnaam te kopen, en een Raspberry Pi B, dus hopelijk kan ik in de toekomst meer uploaden enzo.
Kevin Zegikniet op 21/11/2013 23:22:13:
Dat is dat scriptje van Michael om 15.49?
Ik zal van't weekend er eens naar kijken, het ziet er namelijk niet erg bekend uit voor mij dat eerste stukje.
Ik ben trouwens ook bezig om een domeinnaam te kopen, en een Raspberry Pi B, dus hopelijk kan ik in de toekomst meer uploaden enzo.
Ik zal van't weekend er eens naar kijken, het ziet er namelijk niet erg bekend uit voor mij dat eerste stukje.
Ik ben trouwens ook bezig om een domeinnaam te kopen, en een Raspberry Pi B, dus hopelijk kan ik in de toekomst meer uploaden enzo.
Nee dat is geen java/flash, maar PHP icm javascript (niet te verwarren met java).
Als je met input file werkt, loop je inderdaad nog steeds tegen het limiet aan wat is ingesteld. Deze zou je dus moeten wijzigen met ini_set als je grotere bestanden wilt uploaden.
Code (php)
1
2
3
4
5
6
7
2
3
4
5
6
7
Geupload
Warning: ftp_connect(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /home/u968872759/public_html/ftp.request.php on line 13
Warning: ftp_login() expects parameter 1 to be resource, boolean given in /home/u968872759/public_html/ftp.request.php on line 14
Verbinding met FTP server is mislukt
Warning: ftp_close() expects parameter 1 to be resource, boolean given in /home/u968872759/public_html/ftp.request.php on line 24
Warning: ftp_connect(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /home/u968872759/public_html/ftp.request.php on line 13
Warning: ftp_login() expects parameter 1 to be resource, boolean given in /home/u968872759/public_html/ftp.request.php on line 14
Verbinding met FTP server is mislukt
Warning: ftp_close() expects parameter 1 to be resource, boolean given in /home/u968872759/public_html/ftp.request.php on line 24
Vind ik vreemd: hij gaat eerst "geupload" zeggen, en daarna het hele script afwerken, wat vervolgens faalt...
Getest met in ftp.request.php met en zonder ingeschakeld (niet of wel commentaar).
En ik heb gewoon config geinclude(once). Dus met de gegevens daarin heb ik de verbinding opgezet, wat wel werkt in mijn eigen uploadscript.
EDIT: gewone script vliegt er ook uit, maar connect wil wel. Error daar:
Code (php)
1
Warning: ftp_put(uploads/filmpje.3gp): failed to open stream: No such file or directory in /home/u968872759/public_html/upload.php on line 27
betekent dat ik het directory verkeerd heb. Ik heb geprobeerd:
Basically, elke keer de '/' of de hele map weghalen tot 'uploads/' aan toe...
Gewijzigd op 22/11/2013 16:39:03 door Kevin Zegikniet