answersLogoWhite

0

A basename is a file name without any path or directory information.

User Avatar

Wiki User

9y ago

What else can I help you with?

Continue Learning about Basic Math
Related Questions

I'm testing out a mini social network type website how can I use php HTML or java script for other people to post images to their profile on my website?

Yes, you can allow file uploads to your site.Add the file input to a form like this:Select image to upload:Make sure your upload.php has write permissions and then use the move() function to upload the file to your server:


How do you retrieve image from database using php source code with demo?

Putting an image in a database is a bad practise in itself. Instead put the image name along with extension in the database file and use relative path to retrieve the image from the image folder.For example: If your image is in a folder named images/users then write the following code. The image path variable named $img_path will be stored in database.function upload_Image(){$uploaddir = realpath($_SERVER['DOCUMENT_ROOT']);$filename = $_FILES['file']['name'];$uploadfile = $uploaddir.'/project_name/image/users/'.basename($filename);$error = $_FILES['file']['error'];$tmp_file = $_FILES['file']['tmp_name'];$size = ($_FILES['file']['size']/1024); // File Size will be displayed in kilo bytes$type = $_FILES['file']['type'];if(($type=="image/jpeg"$type=="image/png"$type=="image/gif")&&($size0){echo "Invalid File";}else if($filename==""){echo "Filename not found";}else{if(file_exists($uploadfile)){"File already exists!!"; // To avoid duplication of files}else{if(move_uploaded_file($tmp_file, $uploadfile)){echo "File Uploaded";$imgpath = basename($filename);// connection// select database$query = mysql_query("INSERT INTO db_name (Image Path) VALUES('$imgpath')");if(!$query)echo "File cannot be added to database: ".mysql_error();}elseecho "Could not upload files";}}}else{echo "File is not image type";}}


How do you upload and resize an image with PHP?


how to convert text to speech?

I have used festival with PHP for TTS program. Its very simple to use. If you are running linux, you can simply use "yum install festival" command to install festival package. This package is required for TTS program to work. Windows users can use cygwin to build festival package and place its .so file bin directory of PHP. Once you are done with installation of festival, you can move on to write PHP code that will convert your text to voice recording. Following is the code that creates recording from your text. I have written text into the variable that you can change: <?php //create a random number filename $filename = 'test.txt'; $text = 'This text will be converted to audio recording'; $outputfile = basename($filename, ".txt"); $outputfile = $outputfile . '.wav'; if (!$handle = fopen($filename, "w")) { return false; } // Write $text to our opened file. if (fwrite($handle, $text) === FALSE) { //couldn't write the file. Check permissions return false; } fclose($handle); //initialise and execute the festival C engine $cmd = "text2wave $filename -o $outputfile"; //execute the command exec($cmd); unlink($filename); echo "Recording is successful. \nRecording File: " . $outputfile; //finally return the uptput file path and filename return $outputfile; ?> <a href="weblink">convert-text-to-speech</a>


How do you convert Text-to-Speech with PHP?

I have used festival with PHP for TTS program. Its very simple to use. If you are running linux, you can simply use "yum install festival" command to install festival package. This package is required for TTS program to work. Windows users can use cygwin to build festival package and place its .so file bin directory of PHP. Once you are done with installation of festival, you can move on to write PHP code that will convert your text to voice recording. Following is the code that creates recording from your text. I have written text into the variable that you can change: <?php //create a random number filename $filename = 'test.txt'; $text = 'This text will be converted to audio recording'; $outputfile = basename($filename, ".txt"); $outputfile = $outputfile . '.wav'; if (!$handle = fopen($filename, "w")) { return false; } // Write $text to our opened file. if (fwrite($handle, $text) === FALSE) { //couldn't write the file. Check permissions return false; } fclose($handle); //initialise and execute the festival C engine $cmd = "text2wave $filename -o $outputfile"; //execute the command exec($cmd); unlink($filename); echo "Recording is successful. \nRecording File: " . $outputfile; //finally return the uptput file path and filename return $outputfile; ?> <a href="weblink">convert-text-to-speech</a>


Is it possible to inter image into webpage if it is possible can any one tell me each of the steps of saving and access the image from the webpage?

If I understand your question correctly, you are asking for a technique to allow users to upload an image and then see it on the same page.In answer to your first question, yes, it is possible. Depending on how you want to do it though, it can be quite tricky.If you're not concerned about reloading the page after submitting the image, then it's relatively easy to do. Just add a form to the page, with a file field that allows them to select an image. When they submit that form, they will be posting the image file to your server. You can then store that image file wherever you want, and output the contents of the same page, but including the new image.To get the image from the submitted form, you need to make use of the variable $_FILES. You might do it with something like this:$fname = $_FILES['imgfile']['name'];$location = "image_uploads/" . basename($fname) ;if(move_uploaded_file($_FILES['imgfile']['tmp_name'], $location)){// yay! success}else{// aww - no luck with the image upload}In that example, 'imgfile' is the name of the form field that the image was submitted in. 'image_uploads' would be the path you want to keep the uploaded images in.You can then take that image and use it in redrawing the page for the user to see. If you want that image to remain consistent throughout the user's session, you'll need to track them some way. By far the easiest way to do it is to use the $_SESSION variable to retain the path of the image.Back to your original question - if you want the image to show up without having to re-send them the whole page, then you'd have to do it using AJAX requests. This is actually rather tricky using a file upload, as you can't do it directly with Javascript. I know of two ways to handle this:Handle it with Flash. I can't offer any instructions on that, as I do not know Flash well enough to describe how it works. You can upload files that way though. I know there is at least one jQuery plugin that will do exactly that for you.Add an embedded frame in the page, and submit the from there. Once the server sends a response to that frame (perhaps just the path of the new image), you can use Javascript to grab that path and update the main part of the page with it. There are jQuery plugins for handling this technique as well.