2

私は次のことが可能かどうか疑問に思っています:

  • ローカルコンピューター上のファイルをいくつかの部分に分割して、FTPサーバーにアップロードできるようにします(この方法でファイルサイズの制限を回避します)
  • すべてのピースを私のWebサーバーにアップロードします
  • PHPスクリプトを使用して、それらを1つのファイルに再結合します

HJSplitについては知っていますが、状況を回避するためのものです(サーバーで分割してから、ローカルコンピューターで再参加する)

誰かが可能な解決策について知っていますか?

4

2 に答える 2

1

このサイトは、分割してから参加するためのいくつかのパッケージを持っていると主張しています。
しかし、それらが機能するかどうかはわかりません。(試していない)

于 2012-08-19T23:51:47.203 に答える
-1

これにより、分割部分が作成される可能性があります。

    <html>
<body>
  <label >
  <div align="right" >
  </div>
</label>
<form method="POST" action="">
    <table>
        <tr>
            <td>Here you Files to spilited</td>
            <td>Value</td>

        </tr>
        <tr>
            <td> For spilt Zip File to  paste Its Url</td>
            <td><input type="text" name="zipurl" /></td>

        </tr>
        <tr>
            <td>Spilt to Valume Size:  part</td>
            <td><input type="text" name="spitsize" value="50"/></td>

        </tr>
        <tr>
            <td>Mega bite (1 On/ 0 off) </td>
            <td><input type="text" name="megabyte" value="1"/></td>

        </tr>
        <tr>
            <td>Kilo Byte (1 On/ 0 off)</td>
            <td><input type="text" name="kilobyte" value="0"/></td>

        </tr>
    </table>
    <input type="submit" name="ssurlsubmit" value="submit" />
    </form>



</body>
<?php 
$mypath = getcwd();
  $mypath = preg_replace('/\\\\/', '/', $mypath);

$targetfolder = $mypath.'/tmp';
echo 'targetfolder is:   '.$targetfolder.'<br />';
    if (!is_dir("$mypath/tmp")) {
mkdir("$mypath/tmp");
echo 'Dir'.$targetfolder.'created'.'<br />';

} 

$targetfolder = $mypath.'/tmp'.'<br />';

/*
if(!file_exists($targetfolder)) {
    if(mkdir($targetfolder)) {
        echo "Created target folder $targetfolder".br();
    }
    else{
    echo '$targetfolder can not be created'.br();
}
}else
{
echo $targetfolder.'$targetfolder exist '.br();
}
*/
?>
</html>

<?php
/*
 --------------------------------------------------
 filesplit.php HJSplit compatiple PHP file splitter
 --------------------------------------------------

 File name: 
    filesplit.php                
 Author: 
    Umit Tirpan 2007-03-22          
    Umit Tirpan 2008-03-12 [remote file support added]         
 Author's Website: 
    http://forum.iyinet.com/

 Description:
    This PHP script, splits the files into smaller pieces in binary.
    It is compatiple with HJSplit, so you can re-join splitted files using HJSplit's Join utility.
    It can split a file up to 999 pieces.

 What is the use, why will I use this?
    Some webmasters do not have shell access to their websites. This prevents them splitting big files, ie. MySQL backups, into smaller files. Splitting a 200Mb file into 10 x 20Mb file may be easy on webmaster to download in pieces. 

 How to run:
    Make sure your webserver has write permission on the target folder.
    Edit variables. 
    Upload (ftp) this file to your webserver or run on your PC.
    For security reason, filename is hardcoded. You can modify code to accept $_GET['filename']

 Run with your favorite browser.
    http://www.<your-web-site>.com/filesplit.php
 Or run on shell (ie. ssh)
    php filesplit.php

 It is Ok to share and modify this code and use in/with your applications. No restrictions.

 */




// ---------------------------
// Edit variables (3 variables)
// ---------------------------

// File to split, is its not in the same folder with filesplit.php, full path is required.

global $ssurl,$filename;
if (isset($_POST['zipurl'])) {
$url=$_POST['zipurl'];
$filename=$_POST['zipurl'];
echo "URL:".$url.'<br />';
}

//  $filename = "http://www.iyinet.com/my-big-file.zip"; 

// Target folder. Splitted files will be stored here. Original file never gets touched.
// Do not append slash! Make sure webserver has write permission on this folder.
$mypath = getcwd();
  $mypath = preg_replace('/\\\\/', '/', $mypath);

$targetfolder = $mypath.'/tmp';
echo 'targetfolder is:   '.$targetfolder.'<br />';
    if (!is_dir("$mypath/tmp")) {
mkdir("$mypath/tmp");
echo 'Dir'.$targetfolder.'created'.'<br />';

} 

$targetfolder = $mypath.'/tmp';

// File size in Mb per piece/split. 
// For a 200Mb file if piecesize=10 it will create twenty 10Mb files
$piecesize = 50; // splitted file size in MB
if (isset($_POST['spitsize'])) {
$piecesize=$_POST['spitsize'];

}

//$piecesize = 10; // splitted file size in MB



// ---------------------------
// Do NOT edit this section
// ---------------------------

$buffer = 1024;
if (isset($_POST['megabyte'])and $_POST['megabyte']=='1') {
//$piece=$_POST['megabyte'];
$piece = 1048576*$piecesize;

}
if (isset($_POST['kilobyte']) and $_POST['kilobyte']==1) {
//$piece=$_POST['kilobyte'];
$piece = 1024*$piecesize;

}
//$piece = 1048576*$piecesize;
$current = 0;
$splitnum = 1;

if(!file_exists($targetfolder)) {
    if(mkdir($targetfolder)) {
        echo "Created target folder $targetfolder".br();
    }
    echo '$targetfolder folder exist'.br();
}

if(!$handle = fopen($filename, "rb")) {
    die("Unable to open $filename for read! Make sure you edited filesplit.php correctly!".br());
}

$base_filename = basename($filename);
/*
$ss=substr($base_filename,-4);
echo substr($base_filename,-4).'<br />';
if ($ss=='.zip') 
 { 
 $end='.zip';

 $base_filename= removeFromEnd($base_filename, '.zip');
 }
 */
$piece_name = $targetfolder.'/'.$base_filename.'.'.str_pad($splitnum, 3, "0", STR_PAD_LEFT). $end;
if(!$fw = fopen($piece_name,"w")) {
    die("Unable to open $piece_name for write. Make sure target folder is writeable.".br());
}
echo "Splitting $base_filename into $piecesize Mb files ".br()."(last piece may be smaller in size)".br();
echo "Writing $piece_name...".br();
while (!feof($handle) and $splitnum < 999) {
    if($current < $piece) {
        if($content = fread($handle, $buffer)) {
            if(fwrite($fw, $content)) {
                $current += $buffer;
            } else {
                die("filesplit.php is unable to write to target folder. Target folder may not have write permission! Try chmod +w target_folder".br());
            }
        }
    } else {
        fclose($fw);
        $current = 0;
        $splitnum++;
        $piece_name = $targetfolder.'/'.$base_filename.'.'.str_pad($splitnum, 3, "0", STR_PAD_LEFT);
        echo "Writing $piece_name...".br();
        $fw = fopen($piece_name,"w");
    }
}
fclose($fw);
fclose($handle);
echo "Done! ".br();
exit;

function br() {
    return (!empty($_SERVER['SERVER_SOFTWARE']))?'<br>':"\n";
}
function removeFromEnd($string, $stringToRemove) {
     $stringToRemoveLen = strlen($stringToRemove);
     $stringLen = strlen($string);

     $pos = $stringLen - $stringToRemoveLen;    

     $out = substr($string, 0, $pos);

     return $out;
 }
?> 

あなたはそれを介してそれをテストすることができます:

http://restss2.frogcp.com/tmp/filesplit%2520%282%29.php

于 2015-02-27T05:20:57.760 に答える