Any Way To Upload Entire Folder?
I'm currently working on a little program that will allow different departments within where I work to upload videos (like training videos or safety videos) and then keep track of who watches them. My guess is that I'll do most of the uploading myself, but I wanted to make it such that I can give anyone access to the upload script so they could do it themselves.
Anyway, we (at the office) all agreed that Flash is the best format for security and ease of distribution. We went out and got a program that will allow conversion of video files to flash and also allow them to have a nice table of contents and controls. The biggest problem is that for the TOC and controls to work on the flash videos, the program creates a friggin mess of files that all relate to each other... and this screws up my 'easy' upload idea. There's no way for this program to create a nice single .swf or .fla that has all the controls and TOC built in, at least not that I've found. :(
Is there any way, other than zipping up a directory and writing an unzipper for the server side, to allow a user to specify a directory where the video resides and just up the whole thing intact?
If not, I suppose I'll have to settle for the single .flv file that is created and dump the controls and TOC... though that's part of the reason we bought this converter program. I'm trying to write it in such a way that it will also play mpegs and avi files down the road if that's what the department has, but to start out we're asking that they send us the movie file so we can convert it to flash.
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Copy Entire Contents Of A Folder To Another
Situation: I am creating a folder based on input from a form and then creating an images folder underneath that -- that works great and I can read and write to the newly created folders AS LONG AS IT IS ONE FILE AT A TIME!!! What I would like to do: I would like to copy the contents of an entire folder over to one of the newly created folders ALL AT ONCE -- or in a loop -- which is what I am trying to do but keep getting denied. My code as it is now: if ($handle = opendir("$sourcedir")) { echo "Directory handle: $handle<br><br>"; echo "Files:<br><br>"; while (false !== ($files = readdir($handle))) { if ($files != "." && $files != "..") { if (!copy($files, $imagepath)) { echo "failed to copy $files into $imagepath<br><br>"; } } } closedir($handle); } all of the variables are working fine... it goes through the loop just fine -- I know this because it prints out the error for every file in the folder... it just won't copy the files over to the new folder while in this loop. Here is the beginning of the error messages: Directory handle: Resource id #2 Files: failed to copy step_c1.gif into /htdocs/www/schemes/adfasa/images failed to copy step_b1.gif into /htdocs/www/schemes/adfasa/images failed to copy step_a1.gif into /htdocs/www/schemes/adfasa/images by the way: adfasa is the folder name brought in by the form and images is the folder I create underneath it. Is this something that is possible to do in a loop? If so, what is wrong with this one. If not, how is something like this done? Of course since I know the files that are in the folder I want to copy from I could just go ahead and copy them ONE by ONE but that doesn't seem to be very efficient.
Upload Folder
I have this code: $uploaddir = dirname($_SERVER['SCRIPT_FILENAME']) ."/Images/"; and it uploads the image to /admin/images/ as the page i'm running it from is in the admin directory. I've tried just using the http:// and it doesn't like it. Could someone please tell me how i can make it upload the image to /images/ instead of within the admin folder.
Upload To Specific Folder
I am working in a directory: /www/domain/ and made the directory /www/domain/images/ What I need is for people to be able to upload images to this folder from a form on upload.php They should click browse and select their file to upload then press the "Upload" button. On the next page I want to display the .jpg or .gif that they uploaded. What is the coding for uploading that should go into the first upload.php script and the coding for the upload_result.php script. I think that the result could be: echo "<img src="images/$file">"; where $file = the image they uploaded. But I cannot seem to figure out what the first code should be.
Upload And Resize To Folder
What I have here is an image upload and resize form. I do not want to maintain aspect ratio as I am using this in a slideshow, so I want to maintain exact width and height with all images. The problem with the script is that it outputs that the file has been uploaded successfully but upon checking the filename is there but its at 0 bytes ! Code:
Can PHP Upload Outside Websever Folder?
I've built a photo database on the intranet with PHP and MsAccess database. I've completed the application with http upload. All works fine untill i found out that upload works only in webserver folder. Which means the files cannot be uploaded into another drive on my web hosting computer. The problem is the hard-disk size of my webserver partition will not be enough for the photos in the future. Anyone have a solution to this? I want a php script that can upload files to differen partitions of my hard-disk and possibly into diffrent network storage folders.
PHP Can Only Upload File Into A World-writeable Folder?
Every time I try to upload a file, it works fine until I use move_uploaded_file() to try to place it in its destination, then I get an error to the effect of: Warning: Unable to create '/path/to/file.ext': Permission denied in /path/to/script.php on line XX This error goes away when I make the folder I'm trying to move the file into a world-writeable one. Has it been other peoples' experience that making the upload folder world-writeable is the only way to move new uploaded files into it?
I Can Upload Files Anywhere Except My Remote Root Folder
Im working on a project with PHP that allows users to upload pictures to my server and then reference them. After going through some uploading tutorials I have the uploading part working Except! I cant upload folders to my remote root folder. I need to allow the users to upload somewhere inside the root folder so they can reference the pictures in code after. Just to clarify the uploading works perfectly if I put the uploads folder anywhere on my computer except the sites remote root folder (or anywhere inside the root folder) I also beleive I am giving the folder all of the proper permissions because I am giving the uploads folder in my root directory (the one that doesnt work) the same permissions as the one outside the root (the one that works) Code:
Picture Upload To Certian Folder When Button Pressed...
I have Three Submit buttons and a image uploader with user verifcation. What i want to happen is when you press the button that says "Submit Pictures", it will upload pictures to the "files/pictures/" directory, when you press "Submit School", it will upload files to the "files/school/" directory, and when you press "Submit Random", it will upload to the "files/random" directory. I made the script so that right now if the user and password are correct it wil upload to the directory "/files". Code:
Remove From $name (folder)/(folder)/[x]/ <-- If Exists To Just Get [x].
I'll be quite honest. I don't have the faintest idea how to do this, while I can do other php without a problem. Once I know how to go about it I'll be okay. It's two things I think? 1. see if there's a trailing slash and delete it. 2. Remove the preceding path to /x, the folders and slashes, and delete them. and then I have x. X by the way is the final folder in a website and this grabs it for me. <? $name = $REQUEST_URI; ?>
Getting The Entire URL
You know how someone submits a form, and it goes to process_form.php, and after processing, redirects it back to that page? How can I get the URL of my page, and after the person submits the form, take them back? For example: viewtopic.php?topic=32&post=4&id=33 Can I store that portion of my URL (along with all the variables)? (I have heard of $_SESSION['url'])
What Can Return The ENTIRE Url?
I'm looking for PHP equivalent to Javascript's location.href property. This returns the ENTIRE url (including any variables that might be submitted to a script). I've looked at phpinfo(), but I didn't see exactly what I am after. If the answer is the HTTP_POST_VARS variable, could someone please give me a simple example of how exactly this variable is to be used in code?
Capturing The Entire URL
Been playing around with capturing the entire URL. I dont have any problems if it a file, i.e. http://www.mydomain.com/somefile.php, I am running into problems with this, http://www.mydomain.com/test This is what I use for "redirection" now (btw, it is IIS (Win2k) and PHP 4.3.2) The test.mydomain.com is setup as a host header under IIS $redirect = getenv("HTTP_HOST"); if ($redirect=="test.mydomain.com"){ header("Location:http://www.mydomain.com/modules.php?name=test"); } The above code works fine. Redirects no problem. However, I am trying to get this to do the same thing: www.mydomain.com/test or www.mydomain.com/test/ and both would take you here: http://www.mydomain.com/modules.php?name=test I have tried every combination of the SERVER vars, but no luck. I either generate a 404 or the test isn't part of the URL.
How To Copy An Entire Array?
can I do this? You see, I want to pass my values in to another page, but you can imagine how it would be insane to try and copy each value in the array individually <A HREF="thepage.php?array[0]=$array[0]&array[1]=$array[1]... etc is there a way to compress an array into a single variable, and then decompress it like: Code: $compressedArray = compress(0, 10, $array); where 0 is the start index, and 10 is the end index then when I want to use it on the other page Code: for ($x=0; $x<=10; $x++){ $newArray[$x] = decompressMe($x, $compressedArray); } I'm sure that there must be some simple little thing like that.... I looked at the php manual, but couldn't really see anything like I'm talking about (or maybe I dont understand it )
Preventing Entire Db Download
I've collected some data and created a db. I am putting together a website allowing users to search the db with a search-query functionality. I am pretty much building a google-like engine, although the data is stored in a MySQL. If I use a GET form in the search page (which is what most engines do), then the query results are displayed in pages where the URL contains the query_string (example, www.blahblah.com/search.php?queryitem1=my1&queryitem2=my2+my3). So far so good, but in my case the data is of a local nature (say, a yellow page type of thing with some extras) and someone can basically pick the entire database by running a script like: wget www.blahblah.com/search.php?zip=00001 wget www.blahblah.com/search.php?zip=00002 .......... wget www.blahblah.com/search.php?zip=99999 This is something I would like to prevent. Could someone please offer their opinion on: 1. how to best go about it with a GET form? 2. Is it indeed doable with a POST form in the search page (as opposed to a GET form)? 3. I've read that the main advantage of a GET vs POST form is that someone can bookmark a search results page (eg. www.blahblah.com/search.php?zip=12356) if it the form is GET. Any other advantages/disadvantages that i am missing?
Passing An Entire Array In PHP
I saw a previous post about sending arrays but did not quite understand the answers. The problem is that I would like to pass an entire array as a hidden input field from one php script to another. I've simplified the code where form1.php calls form2.php when "Go" is hit: form1.php ========= <html> <head> <title>Form 1</title> </head> <body> <h1>Form 1</h1> <form action="form2.php" method=post> <? $record[0]="One"; $record[1]="Two"; printf("<input type=hidden name="record[]" value="%s">",$record); ?> <input type=submit value="Go"> </form> </body> </html> form2.php ========= <html> <head> <title>Form 2</title> </head> <body> <h1>Form 2</h1> <? $record=$_POST['record']; printf("$record[0]=%s",$record[0]); printf("$record[1]=%s",$record[1]); ?> </body> </html> The result is: Form 2 Array=Array= How do I fix this?
Copying Entire Directories
I need to copy all of the files from one directory to another. This has to happen on the fly. The files that are being copied are actually templates for another site that will be created. I have seen the example on php.net under the fopen section but it doesnt work.
One File Throughout Entire Site?
I would like to have a file header.php used throughout my entire website. When I do this however it does not work 100% For example the file maybe in /home/header.php with 10 hrefs for the site. Then if a inc() in /home/dir1/dir2/ uses the file it will of course link wrong. For example Code: <a href="dir1/"> If this is in the header file in the /home dir then when the file in /dir2 uses it of course teh link will look like this to the broswer Code: http://www.domain.com/dir1/dir2/dir1/ of course this is not what I want. Everytime I make a change I'm having to make it to over a 100 files so I would like this one file to be used throughout the entire site.
Including Files From Entire Directory
I have this little news script that stores each entry into a seperate file into monthandyear/day, month date, year hour-minutes-seconds AM/PM so if it was Sunday, March 9, 2003 11:39 PM then the script would store the new entry in the folder named "March2003" and in a file called "Sunday, March 9, 2003 11-39-00 PM" now, the problem i have is i want to have an archive of all my news entries by month, so how do i get the contents of all the march entries displayed onto one page in order of date and time?
Http Authenticate Entire Site
we are validating users in several different sections (each section is in it's own directory..ex. the download section is in /downloads) using http authentication. when a user authenticates in one section they can roam freely in that directory without having to authenticate again. for some reason however, when i change to a different directory and then run a phpinfo(), both $PHP_AUTH_USER and $PHP_AUTH_PW are gone, meaning the user will have to authenticate again. the user can go back to the first directory again and they are still authenticated within that directory. i would like the users to only have to authenticate once for the entire site, but scince there are areas of the site that do not require validation i don't want to make them authenticate until they have to.
Viewing Entire HTTP Header ?
is there a way in code to view the entire HTTP Header? Many of the variables in $_SERVER have much of the header, as do some of the apache functions, but none seem to have a way to show the body that was sent with the request. any suggestions for how i would go about doing this? It's mostly for documentation and instructional purposes, but i'd like to see the results without having to construct them by hand and telnet'ing into port 80 all the time ....
Pass The Entire Array Through A Form.
Im working with an array in my php script and need to pass the entire array through a form. Here is the script. Take a look and tell me if you can see my mistake. I create a dynamic entry screen that has multiple values that I would like to update and want to place them all into an array to update them. At the mo no values are being posted at all. Code:
Can You Send An Entire Webpage Via Email Using PHP?
If you go to File >> Send > Page via email it will send a snap shot of the current page you are looking at via email. can this be done via PHP (or another means) so that I can create a script that will email a webpage automatically to a chosen person?
Sending Entire Web Page To Email
Is it possible to send an entire web page to an email using mailto:person@blah.com function, with what has been typed in the text boxes. And if so what would the code look like.
Optimizing Dynamic Php Code (entire Site)
my web site seems to load rather slow because it accesses the db several times and there is a lot of code (because of features). i was wondering how i could optimize/cache this so that the query is only executed once (until i modify the actual code). any ideas?
Export Entire Site And Save As HTML
I feel as though I will be covering ground that others have posted, but I have searched and not found much at all. Basically, my site is in PHP/mysql, but before I go online I want to save 95% of the site's output as HTML (basically everything but the search pages). This will be around 4,000 pages. Is there a way I can get PHP to save the output that a scirpt generates as a separate HTML file? What I would like to do is build this feature into my admin menu. Thus, when I make a change to the database, I can pull up the individual record, and click on a button that says "rebuild html pages".
Using Just One Entry Point For An Entire Dynamic Site
I'm thinking of an architecture for a medium-complexity dynamic site as follows: - I use one php file, say a.php as the entry point for the entire site. PATH_INFO allows me to pass information to my script by using URLs like http://mysite.com/a.php/user1000 or http://mysite.com/a.php/images/10.gif and perform the appropriate action by calling the appropriate function (which may reside in an included php file) - I use apache's url rewriting to redirect urls like http://mysite.com/page25 to a.php b adding the script name - http://mysite.com/a.php/page25 - Using Smarty to control the actual HTML output. This seems to me like a sound and obvious way to do things (and also rarely done) so my questions are: - Has anyone on this group tried to do or done something like this before, using one entry point for the entire site for maximum control? - If so, what do you think are the pros and cons or this approach?
Entire Query String As Script Variable
How would I pull the query string of an URL into my PHP script for use as a variable inside the script? For example - URL is http://www.mydomain.com/hub.php?ref...bob&lname=smith In my hub.php script, I want to set a variable $foo = "ref=affiliate1&fname=bob&lname=smith"; (or whatever the actual query string happens to be)
PHP Http Authentication - Cannot Secure Entire Directories?
I've been trying out HTTP authentication with PHP (yes I've read the Zend tutorial, searched the forum, and read the manual). Things seem to work great. However I have noticed that is does not work like a .htaccess file would. Only the PHP script which sends the headers will check for anything. No very useful for blocking out a whole directory tree. I wanted to move away from just using a .htaccess so that I could authenticate the passwords over a MySQL database. The current setup has an index.php in the directory that is to be protected. It checks for password, then initializes a session and forwards the user to the protected section. Each script in the protected section checks if valid session exists, and if not, forwards back to the main index.php to HTTP authenticate again. This seems to work fine except I'm afraid of one day forgetting to check for the session or people accessing non PHP files that are in the protected directory. My question is, is there a way to combine PHP based http authentication with a .htaccess file? Or somehow have an entire directory be authenticated through one script. And the other concern is that if I do have the entire directory protected and go through that one PHP script somehow, wouldn't it have to check the l/p with MySQL every time they accessed any file?
Regular Expression Detecting Entire Page
I am making a flat file, static HTML search engine for a site. I downloaded a script from the net and have been working with it for my needs. Everything was working OK with a few test Lorem Ipsum pages. But the moment I try to search real data, fit hits the shan. The script uses a regular expression to search through the files. And for most of these files, the regular expression doesnt seem to pick up the matches as it should, and for lack of a match, it outputs the entire html page as a hit. The search word is on the page somewhere, but it still outputs the entire page. Allow me --------8<---------------------------- if(preg_match_all("/((sS*){0,3})($keyword) ((s?S*){0,3})/i", $portion, $match, PREG_SET_ORDER)); { if(!$limit_extracts) $number=count($match); else $number=$limit_extracts; for ($h=0;$h<$number;$h++){ // no limit if (!empty($match[$h][3])) $text = sprintf("... %s<font class='keyword'>%s</font>%s ...", $match[$h][1], $match[$h][3], $match[$h][4]); else{ //print_r($match); } } } --------8<---------------------------- There's the regex that looks through $portion, which is the strip_tags version of the file's contents. And if I echo $portion right before that line, I see the stripped code. However, when I get to the line where it checks $match[$h][3] for the keyword that was searched for, it craps out. Not 100% of the time, but most of the time. Im trying to figure out details about these html pages, to no avail. So as a result of failing that empty test, the entire html page is dumped out as a search result. Not being a regex expert, Ive had a hell of time troubleshooting. But I feel the problem lies in there. Something with the regex not finding the keyword correctly, or something.
Part Of The Script To Refresh With Out Refreshing The Entire ?
I am have a script, and in that script I have a section that pulls information from a database. I also have a drop down box that allows the user to slect which category they want the data to be pulled from. As of now, the way I have it, after they make a selection, the entire page gets refreshed and the new category is loaded. How can I make it that only that section of the script gets refreshed?
Match Regular Expressions In A Webpage, Not The Entire Source
In order to check availability, I want to visit many different pages from a database and try and match the regular expressions 'out of stock' or 'unavailable' or 'sold out' etc. If found, the product will be flagged as unavailable. I tried using fopen() and preg_match() but the problem is, if the reg. expression is present in javascript or in comments, the item gets wrongly flagged. Is there a way of taking what appears on the users screen, after parsing the page, and looking at it as a string I suppose ?
Trying To Unset Single Session Variable Unsets Entire Session
I have all the data being stored in session variables, so when the student puts in his student ID, it passes it from one page to the next. After the student votes, I use a function called logout that checks if the vote was counted, then uses session_unset($_SESSION['studentID']) and I also have a place that passes an error through session to let the user know of various problems with their login, such as if they have already voted. if voting is disabled, or if there are no candidates to vote on. The problem I am having is when I use session_unset, it unsets ALL session variables, not just the ones I want. php.net says not to use session_unregister if register_globals is disabled, which it is. What else can I do? I need to be able to unset only $_SESSION['error'] (the returned error message) and $_SESSION['studentID'], instead of unsetting the whole session.
Modify Image Upload Scripy To MP3 Upload Script
I am using the following script to upload images to a database. I am pretty new to PHP, but what I would like to do is, modify the script so that it handles MP3 uploads instead of image uploads. Is that possible with this script? If so, has anyone got any ideas how I would go about it? Code:
Upload Jpg With Ftp -fine, Upload With Php Wrong File Type!
i've scripted a file uploader, about as basic as you can get, and works on all accounts except that it tells me every single jpg is the wrong file type - BUT i can ftp all these same images and they all behave correctly. echo filetype($type_file); //got this warning Warning: filetype() [function.filetype]: Lstat failed for image/pjpeg any ideas?
Upload Questions - Upload 20 Files At One Time
I've a FORM to upload 20 files at one time, I want it upload 50MB without any problem. I need to set PHP execution to high time, I think, I use ini_set(). But, how can I specify maximum of 50MB, I've an array of 20 files in a FORM. Next I think, it's bad to allow 50MB, should I step-down to 10MB or what?
Upload Form And Upload Script On Same Page
On many upload pages, the FORM action is set to the same page-that means the script to generate the page and save the uploaded files is same.Can somebody give me some simple example of how to do this ? How to detect if somebody is accessing a page( == generate the form) or uploading the files ( == upload the files) ?
How To Get Folder Name Out Of
An easy one for somebody, but I have not got my head round it yet. I need to get the folder name out of a URL ie: /support/desktop/documents/general/fa95e9e698c76fdc606f3b94fe89b48b/17_Import_data_en.pdf $folder = fa95e9e698c76fdc606f3b94fe89b48b;
PHP 5.2 Doesn't Have Ext Folder?
I just downloaded and installed php v5.2, Apache 2.2 and mysql 5.0.27. I'm having the same problems as many regarding the "undefined function" error and am trying to work through it, but I'm noticing (via many of these troubleshooting tutorials) that people are talking about an "extensions" folder and a php-recommended.ini file and the such, and I notice that I don't have either in my installation of 5.2. Did I download the "preferred" installation package? The one I downloaded is called php-5.2.0-win32-installer.msi. I'm coming from a php 4.4.2 apache v1.3.31 and mysql v4.0.20a - all of which was lost during a major crash so I have nothing to compare these 5.2 files against. If I've downloaded a "non-preferred" installer, could someone tell me which one I should install to get everything working properly -- or at the least to have a complete package.
Folder Name As A GET?
I currently have a website and would like to be able to give my members an alias to access their profile. At the moment, people have to go to something like www.domain.com/viewmember.php?id=3456, which isn't practical unless it's through clicking links. I'd like to be able to give my members the ability to use something like www.domain.com/myname, which would then forward to the correct page. The problem I can see is that the server thinks myname is actually a folder and returns a 404 error. Does anyone know of a way to do this?
Check For Folder
how would i check if there's at least one folder in the current folder? the current folder is $dir/$f/ this is what i have, but i know its wrong $fillle = "$dir/$f/"; if (file_exists($fillle)) {$Q="true";} else{$Q="false";}
Folder Retrieval
I have managed to retrieve a list of pdfs that are in a folder and displayed them with a link to a new window: <?php //RETRIEVES FOLDERS CONTENTS $dir = "/var/www/html/bbcl/building/projects/pdfs"; $folder = "/bbcl/building/projects/pdfs/"; $handle = opendir($dir); while ($file = readdir($handle)) { if ($file != "." && $file != "..") { echo "<a href="$folder$file" target=new>$file</a><br>"; } } ?> But it also display's the name of folders that live there, anyway of specifing what file extensions to appear in the list?
Rename A Folder
Is there an easy way to rename a folder? A function I am missing?
|