aebstract
-
Posts
1,105 -
Joined
-
Last visited
Posts posted by aebstract
-
-
if (eregi($var1, "^[0-9]{4}$")) { echo "yeah"; } else {
Well, I echo $var1 above this if statement, and it displays 1000. Which should match my statement? So I should end up echoing 'yeah' correct? It does everything in the else section. Not sure what's up :/
-
$query= mysql_query("SELECT * FROM users ORDER BY time LIMIT 1") or DIE(mysql_error()); while($r=mysql_fetch_array($query)) { $username = $r["username"]; } echo "$username";
Tell me what happens when you use that.
-
Use what I said, and do what monkeytooth said:
try
echo $result['username'];
You can also change 'username' in the code I posted to '*' to return all columns of the row you get.
-
Which I happen to not have, he told me to change post_max_size with .htaccess. :/
-
I changed the correct file, it still remains the same setting. I can't reset the server, I'm not the host? I'm waiting on hold right now for a tech support agent though.
-
Okay problem now sits in a position where I changed that size but in my phpinfo it still remains 8M. HRM.
-
$query = "SELECT username FROM users ORDER BY time LIMIT 1";
-
[Tue Mar 17 11:04:24 2009] [error] [client 70.155.67.57] PHP Warning: POST Content-Length of 17461421 bytes exceeds the limit of 8388608 bytes in Unknown on line 0, referer: https://www.berryequipment.net/videos/post/
I'm receiving this error, I'm obviously trying to upload 16MB and my current limit is 8MB. I went in to my php.ini file and changed to this:
; Maximum size of POST data that PHP will accept.
post_max_size = 60M
Is there somewhere else something needs to be set that I am missing? Not really sure where to look to get this limit raised.
-
I'd say it would be all those 's you have inside your echo '';
-
Yeah going with option 2, was hoping to stay away from option 1.
-
Okay I should have explained it a little better, it's not going to be numbers. It'll be a few set things. so it could be: abc h3j 33k aa0. I'm guessing just put in an array and use in_array though? Thanks
-
Don't know what to subject this, but what is the best way to do something like this:
if ($variable == 1 || 2 || 3 || 4 ){ do something }
I know that is incorrect, which is why I asked =[
-
Tried it without the i before replace?
Try this:
$thtml = str_replace(" ", "", $thtml);
-
Okay I threw that in there, sorry it took so long, I was out of work yesterday. Anyways, here is what I have now:
<?php session_start(); header("Cache-control: private"); if(!isset($_SESSION["id"])) { header("Location: /login/"); } if(isset($_POST["submit"])) { $file = $_FILES['userfile']; $allowedExtensions = array("avi", "mov", "mp4", "mpg", "mpeg", "wmv"); function isAllowedExtension($fileName) { global $allowedExtensions; return in_array(end(explode(".", $fileName)), $allowedExtensions); print_r(explode(".", $fileName)); echo end(explode(".", $fileName)); return in_array(end(explode(".", $fileName)), $allowedExtensions); } if($file['error'] == UPLOAD_ERR_OK) { if(isAllowedExtension($file['name'])) { if (move_uploaded_file ($_FILES['file']['tmp_name'], "upload/{$_FILES['file']['name']}")) { echo "Has been uploaded"; } else { echo "Not uploaded:<br />"; print "$_FILES[file][error]"; } } else { echo "Invalid file type"; } } else die("Cannot upload"); } if ($var1 == post){ $content .= ' <form action="/videos/post/" method="post" enctype="multipart/form-data"> <input type="hidden" name="MAX_FILE_SIZE" value="62914560" /> <input type="file" name="file" id="file" /> <br /> <input type="submit" name="submit" value="Post Video" /> </form> '; } ?>
Displaying just one error : Invalid file type
-
The following code is not allowing me to upload any files at all, it returns: Invalid file type.
Any help please?
<?php session_start(); header("Cache-control: private"); if(!isset($_SESSION["id"])) { header("Location: /login/"); } if(isset($_POST["submit"])) { $file = $_FILES['userfile']; $allowedExtensions = array("avi", "mov", "mp4", "mpg", "mpeg", "wmv"); function isAllowedExtension($fileName) { global $allowedExtensions; return in_array(end(explode(".", $fileName)), $allowedExtensions); } if($file['error'] == UPLOAD_ERR_OK) { if(isAllowedExtension($file['name'])) { if (move_uploaded_file ($_FILES['file']['tmp_name'], "upload/{$_FILES['file']['name']}")) { echo "Has been uploaded"; } else { echo "Not uploaded:<br />"; print "$_FILES[file][error]"; } } else { echo "Invalid file type"; } } else die("Cannot upload"); } if ($var1 == post){ $content .= ' <form action="/videos/post/" method="post" enctype="multipart/form-data"> <input type="hidden" name="MAX_FILE_SIZE" value="62914560" /> <input type="file" name="file" id="file" /> <br /> <input type="submit" name="submit" value="Post Video" /> </form> '; } ?>
-
Err, I had my name wrong for my form field. LOL =]
-
*bump* anyone else care to take a look at it?
-
...Yes, there is a folder called 'upload' in my main directory. Yes, you can see the form. Refer to post 1 when I showed the entire page.
-
it wont even let me concatenate things to the end of the variable
?
Just changed it to match up with that,
if(isset($_POST["submit"])) { $target_path = "upload/"; $target_path = $target_path . basename( $_FILES['uploadedfile']['name']); if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded"; } else{ echo "There was an error uploading the file, please try again!"; } }
and
There was an error uploading the file, please try again!
-
Okay, I'll use year as an example and you can do the rest in the same manner:
..."; if (!empty($rows['year'])) { echo "<div class='year'> Class of \".stripslashes($rows['year']).\" </div>"; } echo "...
Would something like that do what you need?
edit: the '...' isn't literal, just showing you that I closed the echo tag and re-opened it after.
-
I'm sorry, do what?
-
<?php session_start(); header("Cache-control: private"); if(!isset($_SESSION["id"])) { header("Location: /login/"); } if(isset($_POST["submit"])) { if (move_uploaded_file ($_FILES['thefile']['tmp_name'], "upload/{$_FILES['thefile']['name']}")) { echo "Has been uploaded"; } else { echo "Not uploaded:<br />"; print "$_FILES[thefile][error]"; } } if ($var1 == post){ $content .= ' <form action="/videos/post/" method="post" enctype="multipart/form-data"> <input type="hidden" name="MAX_FILE_SIZE" value="62914560" /> <input type="file" name="file" id="file" /> <br /> <input type="submit" name="submit" value="Post Video" /> </form> '; } ?>
Okay, so far I am just trying to upload a small jpg and have it moved to my upload folder. With what code I have, this is echo'd out:
Not uploaded:
[error]
-
Run your results through a loop, set a variable to 1 before the loop, then if the number is odd you can just put it in the left column, if it is even put it in the right. Or however you need to structure it.
-
That's what I was going to do originally, but many places in the website link to the root directory to go back home so it wouldn't work out. =[
[SOLVED] cant get eregi working
in PHP Coding Help
Posted
O.O what a stupid mistake. Thanks