Jump to content

Recommended Posts

basically what i'm wanting to do is: upload a file w/ an upload script, and upon upload, 'cp' (in linux) a file in another directory (as to create a new file in a directory that has the same information as the original) using the uploaded files name (file.ext) and adding the extension '.dat' (to make it 'file.ext.dat')... my question is, is there  a cp or duplicate command in php? i've searched, but to no avail...

 

...and you people here are smart :) <-(shameless butt-kissing)

 

TIA

 

~TBare

Link to comment
https://forums.phpfreaks.com/topic/83731-solved-cp-command-in-php/
Share on other sites

yeah... i know that... thanks though...

 

basically, what i'm doing though, is uploading a video file and thumbnail image of the video file... i have a rating system set up that uses hard files (because i don't have sql available on my server (free hosting.. what can ya do?)).

 

so i need to make a copy of 'default.dat' to 'uploaded_file.flv.dat' so i don't get errors thrown @ me...

 

make sense?

works great.. thanks :)

 

code:

<?php
if (move_uploaded_file($_FILES['uploaded_video']['tmp_name'], $uploadfile) && move_uploaded_file($_FILES['uploaded_thumb']['tmp_name'], $uploadfile2)) {

copy("../ratings/dat/video/default.dat", "../ratings/dat/video/".$category."/".basename($_FILES['uploaded_video']['name']).".dat");
chmod("../ratings/dat/video/".$category."/".basename($_FILES['uploaded_video']['name']).".dat", 0777);

echo "$file_name and $file_name2 was successfully uploaded.<br><br>\n";
print "The path to the video file is \"files/video/".$category."/".$file_name."\"<br>\n";
print "The path to the thumbnail is \"files/video/".$category."/thumbs/".$file_name2."\"<br><br><br>\n";
print "<p><a href='../index.php'>take me home</a></p>";

}
else{
print "ERROR: No files uploaded.";
}
?>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.