Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • File Handling with JFile component in Joomla

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 588
    Comment on it

    JFile is the default library class for handling files upload, copy & delete functions. This can also be used to get the file name, extension and renaming a file while uploading.


    Following are the details of functions available that can be used.

    Methods:

    public static string getName( string $file )
    Returns the name, without any path..
    public static string getExt( string $file )
    Gets the extension of a file name.
    public static string stripExt( string $file )
    Strips the last extension off of a file name.
    public static string makeSafe( string $file )
    Makes file name safe to use.
    public static boolean copy( string $src, string $dest, string $path = null, boolean $use_streams = false )
    Copies a file.
    public static boolean delete( mixed $file )
    Delete a file or array of files.
    public static boolean move( string $src, string $dest, string $path = '', boolean $use_streams = false )
    Moves a file.
    public static mixed read( string $filename, boolean $incpath = false, integer $amount = 0, integer $chunksize = 8192, integer $offset = 0 )
    Read the contents of a file.
    public static boolean write( string $file, string & $buffer, boolean $use_streams = false )
    Write contents to a file.
    public static boolean upload( string $src, string $dest, boolean $use_streams = false )
    Moves an uploaded file to a destination folder.
    public static boolean exists( string $file )
    Wrapper for the standard file_exists function.


    For full code snippet you can check the following joomla link:
    https://docs.joomla.org/How_to_use_the_filesystem_package

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: