PHP
  Home arrow PHP arrow How to Split a File During an FTP Upload Using PHP
Dev Shed Forums 
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
iPad news and developer info.
Ads by affinity 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
VPS Hosting 
Forums Sitemap 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
Google.com  
PHP

How to Split a File During an FTP Upload Using PHP


By: Codex-M
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 3
    2009-11-17


    Table of Contents:
  • How to Split a File During an FTP Upload Using PHP
  • Inside the Split Folder Directory
  • PHP File Splitting Script: splitthisfile.php
  • Using the File Splitting Function

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article

     
     
    ADVERTISEMENT


    Summary: One of the known limitations of free hosting packages is the file upload limit. For example, some hosting companies set an upload limit of 500 KB. This means that for any uploads to the FTP server, the file should not be more than 500 KB or else the server won’t accept it and you will not be able to upload your file. Fortunately, by splitting your files, you can get around this limitation; this two-part tutorial series will show you how.

    How to Split a File During an FTP Upload Using PHP
    (Page 1 of 4 )

    Of course, some files that are important for web site functionality exceed 500 KB. For example, if you are running a web application that needs a geo IP database, a typical file for the geo IP DAT file is around 1.1MB. So this cannot be uploaded as one batch because it exceeds the upload limit of 500 KB. Another common example is uploading music or videos such as MP3, wav or .WMV files.

    There is no easy way to break down a file like this (especially if the web hosting company does not allow uploading of archives like .zip, .rar), and technical solutions are needed to upload this file as a single batch without switching to another hosting agency, which can be inefficient in some cases.

    As mentioned in the introduction, this is the first part of a two-part tutorial series. In this part, you will learn how to create the PHP split file script.

    Concept of Implementation

    To provide a glimpse of how you are going to implement the splitting and merging of files, see the flowchart below:

    You need XAMPP installed in your computer. If you are using a Windows-based operating system, you can read a tutorial that will help guide you through the installation process. 

    The "split folder" directory contains the "PHP File splitting script" which will be discussed in this tutorial. Also, the script is a web form which will ask for the name of the file as well as the FTP server maximum file upload limit in kilobytes. You can get this data from your web hosting agency. Make sure the data is in kilobytes (KB).

    Once the split file script has been executed by submitting the form, several parts of the file will be created. This means that the file will be split into "N" parts based on the file size and the upload limit. Details of this process will be covered later.

    After the file has been split successfully, it can be uploaded easily to your hosting FTP server because it is now less than the maximum file upload limit. You are going to upload it to the desired location in your FTP server.

    Along with the file to be uploaded is the "PHP merge script," which is also a web form that asks for merge file settings, such as your exact file name and the number of parts into which the file has been split (these will be discussed thoroughly in the second part of this series).

    After executing the file merging script, the parts of the split files will be combined into one (back to the original file, but this time in the FTP server, NOT in your local host directory). The remnants or remains of the split parts, however, will still be there in your FTP server. In that case, you can simply delete those fragments after successful file merging.

    It is also safe to delete the PHP merge script once the merging has been completed to prevent unauthorized use.



     
     
    >>> More PHP Articles          >>> More By Codex-M
     

       

    PHP ARTICLES

    - MVC and the Zend Framework
    - PHP: Rendering Web Pages Using the Composite...
    - PHP: Creating Dynamic Web Pages with the Com...
    - Secure Encrypting and Decrypting for Your PH...
    - PHP: Creating Single View Objects with the C...
    - PHP: View Object Collections and the Composi...
    - Securing Your PHP Website
    - Determine Link Relevance and Unique Class C ...
    - PHP Composite View Design Pattern: Introduci...
    - Facebook PHP API Applications: A Second Look
    - Secure PHP Programming
    - Facebook PHP API Applications: Basic Introdu...
    - SOAP Servers and Web Services
    - Using XPath, SOAP, and More with Web Services
    - Web Services: SimpleXML


    Code Analysis Tools
    Enterprise code analysis tools that deliver quality and reliable code

     


     


    © 2003-2010 by Developer Shed. All rights reserved. DS Cluster 2 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek