Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    PHP




Creating / Removing A Remote Folder


I thought there had to be an easy way to do file functions relating to folders, eg: create/modify/delete. Is there? Or am I in for some sort of craziness?




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
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:

Creating A Folder And Page
im is create a php script which when you register (registrationlogin script already made) it will create a folder where it gets the name from the username field and password the folder with the password from the password field it will then create a page in the folder called index.php (i can make the page i just need help with the script to make the folder and page).

Creating A Folder Index With Link
I'm trying to think of ways to create a folder index for a client.
Basically they want to upload PDF's to a folder and have the PHP
script index the folder for a file list with links to the files to be
displayed in a browser. No navigation to other folders. Just a list
of a specific folder with links to the files. This can be done with
simple html and frames but they do not like the look and want more
formating control. Any thoughts. I've seen some file manager scripts
but that is more function than I need.

Creating Predefined Folders In A Bunch Of Folder
This can of course be solved with other things than php, but since I write php myself I was looking for a solution using it.

The problem is:I have folders set up like this /letter/id/ (ie. /g/132/)

What I would like to do is run a one-time operation that creates a totalt of four predefined folders in each /id/ ...
The script would have to go through all letters (ranging from a-z) and make these folders in each /id/.

Anyone Know How To Create Automatic Download Using CURL And Creating A New Folder Every Day???
I want to save a zip file daily. The file is named the same thing
each day so I would like to create a folder and name it with today's
date and then save the zip file into that folder.

I'm using this code and can't seem to figure out how to create the new
folder and save the file there.
Any help is appreciated!

$todays_date = date("Ymd");

$fp = fopen (dirname(__FILE__) . '/file.zip', 'w+');//This is the file
where we save the information
$ch = curl_init('http://www.downloadhere.com/file.zip');//Here is the
file we are downloading
curl_setopt($ch, CURLOPT_TIMEOUT, 50);
curl_setopt($ch, CURLOPT_FILE, $fp);

So each day I should have something like 20070807file.zip.

Drag Files From One Folder To Another Folder (copy) .. Possible?
Is it possible to write codings PHP or Javascript.. GUI representation
of File handling (ie. Drag files from one folder to another folder (copy)
like our windows).. pls give me some reference codings like this..

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;
?>

Removing Bad Words
Looking for suggestions on how to handle bad words that might
get passed in through $_GET['item'] variables.

My first thoughts included using str_replace() to strip out such
content, but then one ends up looking for characters that wrap
around the stripped characters and it ends up as a recursive
ordeal that fails to identify a poorly constructed $_GET['item']
variable (when someone hand-types the item into the line and
makes a simple typing error).

So the next thoughts involved employing a list of good words
and if any word in the $_GET['item'] list doesn't fall into the
list of good words, then an empty string gets returned.

Any suggestions on how to handle this?

Removing PHP Coding
I have php coding that is stored in mysql blobs. Now I want to index words in these blobs in an attempt to make some sort of a search engine. Example: How can I use php to make this mysql text:

"Once upon a time there were <?php echo $num_bears ?> bears in a small cage in a zoo in Russia. They had <?php echo $num_relatives ?> relatives that lived there with them."

Change into this: "Once upon a time there were bears in a small cage in a zoo in Russia. They had relatives that lived there with them."

Point is: - remove everything between and including "<?php" and "?>" I'm trying to do some indexing, and I need to remove all my php coding... :)

Removing Characters
I am passing a string over to a calculator form but need to strip out the £ and ,
the string comes over as /index.php?price1=£195,000 this populates an input field as below
<input type="text" name="price1" class="fields" value="<? if ($price1 != "") { echo $price1; } else { echo "100000"; }?>"> I have added at the top of the page

<?
$price1 = str_replace("£", "", $price1);
$price1 = str_replace(",", "", $price1);?>

this strips the £ but gives an error with the comma.

Removing Whitespaces
I try to remove whitespaces from a string using the preg_replace function
like

preg_replace("/[ ][ ]*/"," ",$string);

This works great, but makes no handles all characters in the same way. I
want to preserve data between double quotes. So,
hello world "It is a sunny... world"
shall be reduced to
hello world "It is a sunny... world"

and should not remove the whitespaces between the quotes.

Removing File
I created a dir with a file in it, using php. I set the file mode to 'w'. It worked and everything, but now i can't delete the file. I tried deleting it using php, in ftp, and in ssh. I can't set chmod mode either. I tried chown but that doesn't work. For anything you do, it shows "Operation not permitted".

Removing The .php From Pages
Hi i am new here we run a website called www.example.com and i was wondering if it is possible to remove the .php from the end of a address

For example www.example.com/newsinbrief.php, it would be nice it I could have it as www.example.com/newsinbrief

Is this possible does anyone know how to do it and if so where i could look for the code advise etc.

Removing Duplicates
I'm getting some data from a database, but there are duplicates for every entry. For instance, if you looked a table of posts for this forum, you'd see posts and the author.  I'm getting the author, so there could be hundreds or more of repeats. I'd like to basically get all the uniques in a column. 

Removing Value From Echo
For example.  If had the following coordinates in the database:

-5.717979 54.728432,-5.672246 54.757900,-5.621388 54.786976,

If I then echo them how would I remove the , (comma) at the end?  As I will echoing multiple coordinates from the database, some longer than others I can't simply remove the comma after a certin about numbers.

Removing Delimiter?
I'm trying to remove the delimiter when I use my functions and replace it like PHPBB does {CODE}  instead of <?CODE()?>

What would be a easy way to do that?

Removing Non Characters......
I wanna remove everything else but a-z in my source file ........and replace everything that is not a-z with nothing. I have the below example (but it's getting a parse error). Actually is there an easier way to remove noncharacters (e.g. !@$*$%) from my source file.

<?
$q = $stringoftext
$search = array (""'#'","'$'","'%'","'&'","''","'/'","'@'","'!'","'('","')'","'['","']'","'.'","'+'","'-'","'*'","'{'","'}'","'?'"");
$replace = array ("");
$body = preg_replace ($search, $replace, $q);
?>

Removing Block Of Text
Is there anyway with PHP you could remove a whole block of text???

Say if I had three lines of text and I wanted to strip those three lines out, but the only problem is, it might appear at the top or bottom of the page...How would I do this??

Removing Img Tags With Eregi_replace
I'm trying to remove all image tags from a html document.

<H1>header</H1>
<P>foo<IMG src="asdf.jpg">
<BR>
foo...</P>

I want the "<IMG src="asdf.jpg">" to go away... (for display on an AvantoGo channel).

I suck at regexs...

$html = eregi_replace("<img.*.>", "", $html);

Nukes everything after the img tag (and the image tag)...

Removing A Space After Submitting
I am working on a script that creates options with a number to be inserted into an array PHP Code:

Removing Html From A Blob Via Php
I'm trying to use php ereg coding to remove all html from a blob so that I can parse it into keywords, any Ideas?

Removing Every Even Character From A String
Say I had .a.b.c and wanted to return abc. Any ideas as to how I'd do
this? Here's my attempt, but it doesn't work:
<?php
echo preg_replace('#(?:.(.))+#s', '$1', '.a.b.c');
?>

Help Removing A Simple Space
I need to check for sentences that have a space before the period and
remove the space. I've tried:

$sentence = str_replace(" .", ".", $sentence);

but it does not work. I've tried other ways with no success.

Why doesn't this work and how do I do this?

Removing A Line Within A File?
I have an include file (links.php) with nothing but links, the filenames are dates ( i.e. YYYYMMDD_hhmmss.php), all the links point to files within the same directory (i.e. /data). I read all these files in from the directory with readdir() and then build a form in order to remove certain files. I need to be able look into the include file, find the correct link, and remove it. I have been trying to use a foreach statement and preg_match() and printing back to the file lines that do not match and skipping the ones that do with absolutely no luck. It doesn't seem to match the link within the file.
Here is a snippet of code:

Removing A Comma From The End Of An Array
I am reading a file into an array using this:

$listFile = "add2db.txt";
if (!($fp = fopen($listFile, "r")))
exit("Unable to open the input file, $listFile.");
$buffer = fread($fp, filesize($listFile));
fclose($fp);

The very last character in that $listFile will always be a comma. What I need to do is remove that last comma (and only that comma) from $buffer before I can continue on. What do I need to do to accomplish this?

Help Removing New Line Chars
I have a string that was entered in a web form and stored in a mysql
database where the user entered carriage returns as well as <br>'s
after each line in the form. the data is stored as

line 1<br>
line 2<br>
line 3

i need is to modify the text so instead it reads

line1<br>line2<br>line3

the problem is when i use strpos() and substr() on the multi line
text, i keep getting these invisible chars that i can't seem to get
rid of. even after using trim($string), i still can't get rid of these
buggers.

Removing Characters From A String
I'm trying to remove this line from a string [SA NAVY|49.99|TEST|8|SA-Navy.jpg|] I can remove most of the characters with preg_replace($test,"",$TheBasket); but I get these characters left over for some reason [|||||].

Removing Newlines For CSV Format
I need to take a block of text and remove all the newline chars from it so it can be counted as one entry in a CSV(Comma Separated Values) formatted file. I've already got it removing the commas from the text like so: PHP Code:

Removing Text From A String
Is there a way to remove text from the beginning of a string up to (and including ) a keyword, then including and after another keyword? Use the following sentence as an example. This is a test sentence that I wish to automatically change.

keyword 1 = test
keyword 2 = automatically

so it reads 'sentence that I wish to' My guess is the answer lies in the regular expression area but I am unsure.

Removing File Entries
I am using php3 and someone told me that php3 does not support foreach. In that matter, how would i go about grabbing lines from a file, iterating through all the entries and only delete the one that matches a string. I was thinking of a for() statement but I do not know what the php equivalent of perl's splice() is?

Removing Some HTML With Preg_replace
I need to be able to upload a file (html) to the server and strip away
everything up-to and including the <BODY> tag and everything from
</BODY> down. I have a perl script that does this successfully using
the following 2 lines...
$progress_report =~s/^.*<BODY.*?>//s;
$progress_report =~s/</BODY>.*//s;

I want to be able to do this with php. Can anybody help me with this?
I tried using hte regexp above in the preg_replace() function, but it
did not work.

Removing Multiple Files
We are trying to remove multiple files (with different extentions) and having some PHP syntas troubles:

unlink("..$dir/some_string.*");

does NOT seem to work! In other words, we are trying to 'imitate UNIX rm some_string.*

Removing Attribules From HTML
I just noticed that the firefox bookmarks page in over 500KB, while it displays on 22KB of text on the screen. I carry this file with me on my disk-on-key so it is important for it to be small. I want to parse entrys like this too make them smaller: Code:

Removing ToolBar From Browser...?
Just wondering there is any other way to remove the toolbar from the browser
than using

" ...toolbar=no ..."

in the

window.open(...)

is there a way to do it after the browser opened? (say some Java script)

are there any parameters or style like stuff that can be embedded in the
HTML code and does it when the new page created?

or is the above method the ONLY way?


Removing Newline Characters
How would you remove newline characters from a string?

I tried: str_replace("", "", $string);

But that doesn't work.

Removing Parts Of An Array
how can i remove parts of the array with no 'picinfo'? Code:

Removing Subdomains From Strings
I need to get the domain name and the .com/.net... etc.

For example:
foo.com > foo.com
www.foo.com > foo.com
somesubdomain.foo.com > foo.com
one.two.foo.com > foo.com

I need to get the foo.com part in all cases. What regexp/function could i use?

Removing Illegal Characters
I have an upload script for a photo and a caption. It all goes pear
shaped when I upload a character like ' " or / |
Is there anyway I can parse through the filename when submitting the
form and remove any illegal characters like this?


Removing Odd Characters After Socket_read
I'm having a major issue in which I am reading data from a telnet
server with socket_read, and the data apears to be coming back with
what seems like either line feeds that stay on the same line or
left-arrow characters. I can't really figure out what is coming back,
so I'm not sure how to parse it out. If I simply dispay it on a web
page, it works, but if I try to feed it through an ajax call, it prints
the first line, then stops. I'm sure this is because it line feeds on
the same line or something. Also, I cannot do proper regex matching on
the lines as well.

Is there anything in PHP that can clean up these lines? Or would I have
to build a preg_match statement and only allow letters and punctuation?



Removing Slashes When Using Mail()
I have been sending emails using PHP with the mail() command/method.
When I send them tho it adds slashes, for example:

'hi guy's' gets sent as 'hi guy's'

Why is this? How do I sort this?

Removing All Spacing In A String.
The snip below prints "1245 Long Tree Dr" How do I make it, print "1245LongTreeDr"?

while($info = mysql_fetch_array( $data )){
Print "".$info['address']."";}

Removing Everything But Numbers In A String
I am not sure if this is simple, But how can I remove everything in a string that is not a number.

Example: "f240fh02n,432534j,234l;sdcfu8904" would equal "240024325342348904"

Removing Links Without Http://
Is there a specific way to search a string and remove a '.com/.etc' basicly if theres no space after the ., it would realize its a link.. like is the content was 'hello this is fun. you are now here.net here.' It would remove the here.net completely from the string.

Simply I'm trying to remove links without http:// the best way. Guessing it would be by tracking the ending .'whatever'

Removing HTML Tags
I am using ajax, so I am manipulate the text with either php(prefer) or javascript.
I have a text area where the user enters whatever. They click send and a 'js' function gets called and it calls my sendRequest function and sends over the data to my php file to be insert into my db.

What I want to do is remove any of the html/js tags I can. The only thing I want to keep is the spacing the user enters (line spacing).

My php file - I have tried many different ways, but none of them seem to work

$txt = $_GET['text'];

$stuff = array("","");
$txt = str_replace($stuff, "<br />");
echo strip_tags($txt, '<br />');

So using the code above if I enter:
<b>Test</b>

This is a test

The Results is:
TestThis is a test

I've tried another method using 'preg_match', but i am getting an error b/c of the function.

Removing Page Style
I found a great script which turns a HTML page into a PDF, but the problem is it turns the whole page, with layout etc, into the pdf, which looks really bad with all the navigation etc, on it. Code:

Removing Word Formatting
I've recently built a simple CMS system with a textarea that the user can use to bolden text etc.

If you type directly into the box and then apply styling such as "bold", it works fine. The problem is that when you paste text from Microsoft Word, it seems to take all the MS word formatting, which really screws the page up and changes all the styling.

Does anyone know of a script which can clean up the word formatting and remove all the tags word might have added and then insert the new cleaned up text?

Removing Special Characters
I have a form that has a text box:

<input name="weight" type="text" id="weight" size="10" maxlength="5">

When to form is submitted, how do i make it to where the users cannot add any special characters like a comma for instance. This field is for a weight result value, but i need it to be all numeric at result. How can i strip it or make it return an erro on submit.

Currently my error system is like so:

if($weight ==     ) {   //This is where i want to add the check for special characters//
     $msg[] = $error7;
     header("Location: quote_error.php?");
}

Removing Multiple Values
I'm still pretty new at PHP so I'm sorry if this is a simple question. On the homepage of my site I am trying to display the titles of my most recent wordpress blogs. However, I don't want it to show more than one result with the same value. I just want it to show the first result with that value. Code:

Removing Bad Characters From A String?
Can someone point out the best method to check that a string is only alpha-numeric using an if/then statement. I was thinking ereg, but I've never used it, and frankly, it's a bit intimidating.


Copyright © 2005-08 www.BigResource.com, All rights reserved