jazzman1
Staff Alumni-
Posts
2,713 -
Joined
-
Last visited
-
Days Won
12
Everything posted by jazzman1
-
Hey Q695, sorry for the delay but I'm so busy and tired these days. So find and open up the php conf file named php.ini with your code editor and change next lines: upload_max_filesize = 200M and post_max_size = 200M, then restart your web server and try again! <?php error_reporting(-1); echo 'file count=', count($_FILES),"\n"; echo '<pre>'.print_r($_FILES, true).'</pre>'; echo "\n"; ?> <form enctype="multipart/form-data" action="" method="post"> Choose a file to upload: <input name="uploadedFile" type="file" /><br /> <input type="submit" value="Upload File" /> </form> // Result with my binary file file count=1 Array ( [uploadedFile] => Array ( [name] => xss.mp4 [type] => video/mp4 [tmp_name] => /tmp/phpGIb4ZW [error] => 0 [size] => 37174389 ) ) Do you try to upload the video file directly using insert and LOAD_FILE() function like in my example above? PS: I will try to provide an example with this later on.
- 23 replies
-
For the application server, try the following code and tell me if you're getting some error or warning: <?php error_reporting(-1); if(!empty($_POST['uploadedFile'])) { echo 'file count=', count($_FILES),"\n"; echo '<pre>'.print_r($_FILES, true).'</pre>'; echo "\n"; } ?> <form enctype="multipart/form-data" action="" method="post"> Choose a file to upload: <input name="uploadedFile" type="file" /><br /> <input type="submit" value="Upload File" /> </form> For the db server I'm going to provide a different option, because I'm not familiar with phpMyAdmin, WAMP and windows versions in general. Open up the command prompt in your windows machine, and start mysql command line tool. After you've been connected once to the db server and chosen your database try to insert this video file directly to db table. It could be similar like this: INSERT INTO table VALUES(LOAD_FILE(C:/full/path/to/video.mp4)); If you got the error like shown above " MySQL server has gone away", find where the mysql conf file inside your wamp application is and add next line into it, then restart the db server. max_allowed_packet = 1024M
- 23 replies
-
Sounds like the upload file limitation directive is lower than the video file you're uploading.
- 23 replies
-
pass values to another page using javascript
jazzman1 replied to subhomoy's topic in PHP Coding Help
You need to echo a proper javascript function/method by php because the query string of the source attribute is parsed by javascript. This should work: myscript.php <?php $uid = $_GET['uid']; echo "alert('Query ID = '+$uid)"; However, as already suggested above use AJAX. -
Not sure if this can be done. But want to try.
jazzman1 replied to Mancent's topic in PHP Coding Help
I already told you in this thread, why that happens based on my experience. Try to change the relative path to absolute. &path=sounds/foldername/output //to something similar &path=C:/Apache/sounds/foldername/output/ -
The name of the input submit element is "enter" not "submit". Did you see that?
-
There is an error here, since typical usage of a query fragment never includes the hierarchy ("/") character, and the query component is not normally used within relative references. Some clients (browsers) ignore them some not, trying to merging it as a part of the base path.
-
images to emmbeded images this src not working
jazzman1 replied to antonyfal's topic in PHP Coding Help
Change, if(preg_match('/<img[^>]+>/i', $msgBody)){} //to if(preg_match_all('/<img[^>]+>/i', $msgBody)){} You have redundant data. -
Ops....my mistake, I wanted to say - many rows with status "Disable" Why the "student_id" is equal to "jenny"? What the output of this variable is - $student_id = $_POST['student_id']?
-
Before to get yourself into a different direction you need to step back trying actually to understand what causes your current problems. The best way is to teach yourself how to debug your php scripts. Brake up your script(s) into small pieces and fragments of data and debug them. You could make a google research - "how to debug in php", for instance.
-
Read the article again. You're completely lost in the tango!
-
Turn the error reporting on, to see what actually happens! You have a directory/file issue here. Where this mp4 file is? In a web root directory or in videos/foldername/output? PS: Not to mention that this query string is incorrect: URL:http://192.168.0.8/getfile.php?uid=1&mid=1&at=33c1a0d7a97493820ff4dadc42430841&security=1&f_stat=1&path=videos/foldername/output&getfile=c6f46d45bc02173543156c552764c939.mp4 Request Method:GET
-
An abbreviation of LAMP also represents (for me) - Linux/Apache/MySQL/PHP/Perl/Python
-
Why did you close the connection and then you want to run a new sql select statement? echo "Entered data successfully. Redirecting in 2 seconds.\n"; mysql_close($conn); header('Refresh: 2; URL=edit.php'); } else { ?> <form method="post" action="<?php $_PHP_SELF ?>"> <table width="100%" align="left" border="0" cellspacing="1" cellpadding="2"> <tr> <td><label for="company_id">Company</label></td> <td> <select name="company_name"> <option value="">--- Select a Company ---</option> <?php $sql_select = "SELECT * FROM `company`"; $retval_selectcompany = mysql_query( $sql_select, $conn ); while($row = mysql_fetch_assoc($retval_selectcompany)) { echo '<option value='.$row["company_name"].'>'.$row["company_name"].'</option>'; } ?> PS: Why don't you read what gurus suggested above to debug mysql queries using a mysq_error function? $retval_selectcompany = mysql_query( $sql_select, $conn ); // to $retval_selectcompany = mysql_query( $sql_select, $conn ) or die(mysql_error()); More, you should echo this php variable to get some result, but it's not the issue here. <form method="post" action="<?php $_PHP_SELF ?>">
-
Can I see your actual updated php script after reading the article above?
-
images to emmbeded images this src not working
jazzman1 replied to antonyfal's topic in PHP Coding Help
Try (not tested), it should work <?php $string = 'Content-Type: image/jpeg'; header($string); $filename = 'http://hi5.taggedmail.com/imgsrv.php?sz=1&uid=5458308947'; $pic = file_get_contents($filename); echo $pic; -
images to emmbeded images this src not working
jazzman1 replied to antonyfal's topic in PHP Coding Help
You need to use a header() php function with a content-type you're expecting the server to return to the browser. What policies Mozilla changed to Mozilla Thunderbird? Can you post a link, please? -
Most likely this condition is not satisfy and mysql server returns null result -> where student_id='$student_id' and student_password='$st_pass' and student_status ='Enable' I see many columns with status 'Disable'.
-
I want to run the DESCRIBE command to list all involved tables in this query first. second, try to provide some sample of data and third, describe what result you're expecting to get.
-
What do you want to achieve? To concatenate a php variable to an sql string? See what would happen if I set two randomly php variables to your sql query. <?php $all_id = 10; $sqladd = "abc"; $sql = "select a.id, a.first_name, a.last_name, a.image, b.sh_id, b.uid, b.parent_id, b.sh_det, b.attach_url, b.attach_image, b.attach_title, b.attach_description, b.date, c.ltotal, d.ptotal from share b inner join user a ON b.uid = a.id left outer join (select count(sid) as ltotal, sid from share_like group by sid) c ON b.sh_id = c.sid left outer join (select count(sh_id) as ptotal, parent_id from share group by parent_id) d ON b.sh_id = d.parent_id where b.uid in ('.$all_id.') and b.parent_id = 0 '.$sqladd.' order by b.date desc "; echo $sql; Result: select a.id, a.first_name, a.last_name, a.image, b.sh_id, b.uid, b.parent_id, b.sh_det, b.attach_url, b.attach_image, b.attach_title, b.attach_description, b.date, c.ltotal, d.ptotal from share b inner join user a ON b.uid = a.id left outer join (select count(sid) as ltotal, sid from share_like group by sid) c ON b.sh_id = c.sid left outer join (select count(sh_id) as ptotal, parent_id from share group by parent_id) d ON b.sh_id = d.parent_id where b.uid in ('.10.') and b.parent_id = 0 'abc' order by b.date desc I see two errors here - b.uid in ('.10.') and b.parent_id = 0 'abc' For a list of tables in your current schema, use the DESCRIBE command, which provides a decription of the specified table, if you want to help you effectively.
-
and b.parent_id=0 '.$sqladd.' //error
-
The name of the language is "BASH" no "BATCH". So, learn the basics first before to practise. I'm using this resource.
-
There is no real benefit of using "IN BOOLEAN MODE" against "FULLTEXT" search like in the example above. Not very familiar with this, but using boolean searches, you can easily determine what strings (or group of strings) should or should not appear in query results. If I modify a little your example the following query will return all rows where title and body columns contain "jazzman" but not "Drongo_3" SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('+jazzman -Drongo_3' IN BOOLEAN MODE); Plus sign indicates that the following string must appear in the matching rows, the minus sign - NO. There is much more to say but it depends on your wishes.
-
This coding practice to mix up sql/php/js/html, etc....in same document is bad. If you want to use sql/php and js you should consider of using AJAX! To your question, the following works for me (tested a minute ago) while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) { echo "<script type='text/javascript'>"; echo "alert('{$row['names']}')"; echo "</script>"; }
-
What do you want to achieve? To change the current prompt based on the last directory command when all commands of the script are finished or just to list all sub-directories and files during the process?