OT: Create a folder using PHP?

I'm trying to create a folder in PHP, and I'm using this
markup -
<?php
$dir = 'test';
echo(!mkdir('/images/'.$dir)?'Fail':'Success');
?>
Shouldn't that work (I'm hosted on Windows, but it's PHP5)?
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com
- Template Triage!
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
http://www.macromedia.com/support/search/
- Macromedia (MM) Technotes
==================

The images directory is already there.
> cost me an hour to get recursive switch to work in
windows with php 5.2.0,
> so
> share it here. The key is backward slash in windows ,
this php version
> doesn't
> recognize forward slash as valid path separator for
mkdir(), though other
> functions support forward-slashed paths just fine. The
following example
> works
> in Windows:
> <?php
> $mypath="testdir\subdir\test";
> mkdir($mypath,0777,TRUE);
> ?>
> This doesn't work in windows:
> <?php
> $mypath="testdir/subdir/test";
> mkdir($mypath,0777,TRUE);
> ?>
>
This is likely the answer. I'll try it.
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com
- Template Triage!
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
http://www.macromedia.com/support/search/
- Macromedia (MM) Technotes
==================
"digitalus media" <[email protected]> wrote
in message
news:edhej7$rfo$[email protected]..
> you need to make the directory structure one level at a
time. so make the
> images directory, then make your test directory. once
the images folder is
> created your code should work, just remove the first
forward slash (before
> images). this works on my wamp server.
>
> also check out this comment on the php.net page:
>
>
quote:
> cost me an hour to get recursive switch to work in
windows with php 5.2.0,
> so
> share it here. The key is backward slash in windows ,
this php version
> doesn't
> recognize forward slash as valid path separator for
mkdir(), though other
> functions support forward-slashed paths just fine. The
following example
> works
> in Windows:
> <?php
> $mypath="testdir\subdir\test";
> mkdir($mypath,0777,TRUE);
> ?>
> This doesn't work in windows:
> <?php
> $mypath="testdir/subdir/test";
> mkdir($mypath,0777,TRUE);
> ?>
>
>

Similar Messages

  • How to create a Folder using java.

    Hi All,
    I have a doubt. I want to create a folder using java.
    Inputs are the destination where the folder should be created and the name of the folder. Plz help me in this regard.
    thanks and regards,
    Vincent .R.

    check out javadoc for java.io
    File reldir=new File("NewDir");//relatively where your program runs
    reldir.mkdir();
    File absdir=new File("C:/NewDir");//absolute path
    reldir.mkdir();
    File newdir=new File(absdir,"SubDir");//defines another dir under absdir
    newdir.mkdir();
    Gil

  • How to create a folder using plsql

    hi all
    i want create a folder using plsql procedures .

    I am not sure weather you can create a folder on database server file system using pl/sql code but you certainly can create/read/write file system files using UTL_FILE package.
    'The Oracle supplied package UTL_FILE can be used to read and write files that are located on the server. It cannot be used to access files locally, that is on the computer where the client is running.'

  • Not able to create sub folder using SharePoint web service in large SharePoint document library (Item count view threshold limit)

    We are trying to create folder & subfolder in a SharePoint document library using SharePoint default(dws) web service. Document library has unique permission as well as item level permission. It was working as expected. Once item count crosses
    view threshold limit ( 5000) , create folder web method completes with an error and it creates a folder in SharePoint.
    Request:
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:dws="http://schemas.microsoft.com/sharepoint/soap/dws/">
       <soapenv:Header/>
       <soapenv:Body>
          <dws:CreateFolder>
             <!--Optional:-->
             <dws:url>Shared Documents/VenTest02092015v1</dws:url>
          </dws:CreateFolder>
       </soapenv:Body>
    </soapenv:Envelope>
     Response:
    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
       <soap:Body>
          <CreateFolderResponse xmlns="http://schemas.microsoft.com/sharepoint/soap/dws/">
             <CreateFolderResult>&lt;Error ID="2">Failed&lt;/Error></CreateFolderResult>
          </CreateFolderResponse>
       </soap:Body>
    </soap:Envelope>
     While trying to create subfolder under the above created folder service throws an exception saying
    FolderNotFound.
    Though we are able to create subfolder from SharePoint UI successfully. 
    Request
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:dws="http://schemas.microsoft.com/sharepoint/soap/dws/">
       <soapenv:Header/>
       <soapenv:Body>
          <dws:CreateFolder>
             <!--Optional:-->
             <dws:url>Shared Documents/VenTest02092015v1/REQ-1</dws:url>
          </dws:CreateFolder>
       </soapenv:Body>
    </soapenv:Envelope>
    Response:
    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
       <soap:Body>
          <CreateFolderResponse xmlns="http://schemas.microsoft.com/sharepoint/soap/dws/">
             <CreateFolderResult>&lt;Error ID="10">FolderNotFound&lt;/Error></CreateFolderResult>
          </CreateFolderResponse>
       </soap:Body>
    </soap:Envelope>

    Yes, you're probably hitting the 5000 list item threshold (
    http://sharepoint.stackexchange.com/questions/105937/overcoming-5000-file-document-library-limits ). I assume you can do it via the UI because you're probably logged in as an admin in which case, out of memory, the threshold is 20.000 items. You can extend
    this limit, but you probably shouldn't.
    Kind regards,
    Margriet Bruggeman
    Lois & Clark IT Services
    web site: http://www.loisandclark.eu
    blog: http://www.sharepointdragons.com

  • How to create a Folder using a SQL Query?

    Hi
    How can I create a Folder (eg. C:\MyNewFolder) using SQL Query?

    Hi,
    I added some code in order to get the result from the xp_cmdshell command
    This returns null if successfull, if an error occurs returns the error message. May be useful instead of getting an sql error
    Code Snippet
    declare @cmdpath nvarchar(60), @Location nvarchar(100), @message nvarchar(max)
    set @Location = N'C:\Temp\Temp5'
    set @cmdpath = 'MD '+ @Location
    Create table #result
    result nvarchar(255)
    insert into #result (result) exec master.dbo.xp_cmdshell @cmdpath
    select @message = ISNULL(@message + ' - ','') + result from #result where result is not null
    select @message
    drop table #result
    Eralper
    http://www.kodyaz.com

  • Create  PCD folder using web dynpro Java

    Hi All ,
    I would like to create pcd folder structure using web dynpro java
    i.e. My folder at top level and under this there will be iviews , roles , worksets  etc.
    Is it possible using WDJ ?
    I have checked the below link , but for folders I did not get anything.
    http://help.sap.com/saphelp_nw04/helpdata/en/44/6aaf92f5a23672e10000000a114a6b/frameset.htm
    Can you please help me ?
    Thanks,
    Sandip

    Hi,
    Please refer to the following document
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/508baf88-9335-2d10-efa6-c6ad61e5fc4b?quicklink=index&overridelayout=true
    The same can be implemented in webdynpro also.
    Regards,
    Raju Bonagiri
    Edited by: Raju Bonagiri on Sep 3, 2010 8:36 AM

  • How to POST (create) a folder using CMIS REST in Webcenter

    Has anyone tried to create a new folder using CMIS REST/Atom calls in Webcenter ?
    Here's what I try to do:
    http://172.31.100.150:7001/cmisrestprelim/cmis/children/MyContentServer ==>POST (using the REST client plug-in in Firefox)
    Content-Type=application/atom+xml
    <?xml version="1.0" encoding="utf-8"?>
    <entry xmlns="http://www.w3.org/2005/Atom"
    xmlns:cmisra="http://docs.oasis-open.org/ns/cmis/restatom/200908/"
    xmlns:cmis="http://docs.oasis-open.org/ns/cmis/core/200908/">
    <title>mytestfolder</title>
    <cmisra:object>
    <cmis:properties>
    <cmis:propertyId propertyDefinitionId="cmis:objectTypeId"><cmis:value>cmis:folder</cmis:value></cmis:propertyId>
    </cmis:properties>
    </cmisra:object>
    </entry>
    This piece of code should create a folder called "mytestfolder" in the root directory.
    When I POST this, I get the following internal server error:
    <pre>javax.servlet.ServletException: com.sun.jersey.api.container.MappableContainerException: com.bea.content.RepositoryException: Please specify a valid ID object. Make sure the repository name is not null.
         at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:310)
         at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:314)
         at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:239)
         at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
         at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
         at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
         at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at com.bea.content.manager.servlets.ContentServletFilter.doFilter(ContentServletFilter.java:178)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:94)
    Anyone has an idea how to solve this ?

    I must admit that I'm fairly new to all the CMIS and REST-things....
    So there are a couple of things in your answer that are a bit hazy to me.
    It looks like you are more familiar with all this.
    How do I find a creatable folder ? And what should be the URI to POST a new folder ?
    I try to POST a new folder using this URI:
    http://172.31.100.150:7001/cmisrestprelim/cmis/children/MyContentServer/IDC:Folder%2F13
    (IDC:Folder%2F13 is the /Contribution Folders/Documents folder in my repository)
    This POST keeps me giving the following internal server error:
    <pre>javax.servlet.ServletException: com.sun.jersey.api.container.MappableContainerException: com.bea.content.RepositoryException: Please specify a valid ID object. Make sure the repository name is not null.
         at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:310)
         at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:314)
         at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:239)
         at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
         at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
         at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
         at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at com.bea.content.manager.servlets.ContentServletFilter.doFilter(ContentServletFilter.java:178)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:94)
    Thanks for helping me out.

  • Best way to Create Shared Folder using Powershell

    Hi
    Does anyone have any recommendations on creating a shared folder using PowerShell? I've used new-item to create a folder, is there a way to share it and give specific name?
    Cheers

    Hi Shane,
    I’m writing to just check in to see if the suggestions
    were helpful. If you need further help, please feel free to reply this post directly so we will be notified to follow it up.
    If you have any feedback on our support, please click here.
    Best Regards
    Anna
    TechNet Community Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Support, contact [email protected]

  • Webutil failed to create temporary folder using Get_work_area()

    Friends,
    We have been migrating from 6i to 10g AS 3-tier environment. We have been using get_work_area() procedure to create temporary folders to transfer report output PDF files for printing. Intially we could able to transfer the files and from there we used webutil_host.blocking to issue the print command. It was working fine. Now webutil is failing to create the temporary folder in the server which was mapped as c:\temp in the webutil.cfg file. We are unable to find the reason behind this failure. Please put your comments for this.
    Apart from this if anybody is having solution to print the file to the local printer, please provide the step for that approach.
    Regards,
    KB

    In case /tmp directory is automatically deleted, is it possible to configure a custom directory for alsbTempJars dir in OSB to assure it is never deleted?Add the -Djava.io.tmpdir=newTempDir parameter in the JAVA_PROPERTIES section of the setDomainEnv.sh script. This new location should be outside of the /tmp dir to avoid being cleared by any process.
    I think best soultion would be to have alsbTempJars automatically created whenever /tmp is purged.Doing it on the fly may not be possible however you may anytime raise an enhancement request with support and if prod dev approves it, you may get a fix.
    Regards,
    Anuj

  • I tried to free up room on my mac hard drive. I went into L3 and connected with an external hard drive. I created a folder using the plus sign in L. I highlighted several folders that were listed in my  LR library and moved them over to the new folder on

    I tried moving images from lLR3 on my
    into an external hard drive in order to free up some space on the mac. something went wrong. ater all the images were moved there is still no added room on my mac, but the folder with the images reads 0. please help

    The folder on your internal drive, as viewed in LR, should read zero photos.
    The new folder on your external drive, as viewed in LR, should contain the proper number of photos.
    I don't know why the internal drive doesn't have extra space now

  • Unzip a folder using pl/sql

    Hi All,
    I am creating zip folder using oracle pl/sql. Now i want to unzip the same folder for taking out the compressed file.
    Is it possible to unzip the folder in oracle pl/sql.
    Thanks in Advance.
    Cheers,
    Shan

    Here's the code
    Anton
    CREATE OR REPLACE package as_zip
    is
      type file_list is table of clob;
      function get_file_list(
        p_dir in varchar2
      , p_zip_file in varchar2
      , p_encoding in varchar2 := null
        return file_list;
      function get_file_list(
        p_zipped_blob in blob
      , p_encoding in varchar2 := null /* Use CP850 for zip files created with a German Winzip to see umlauts, etc */
        return file_list;
      function get_file(
        p_dir in varchar2
      , p_zip_file in varchar2
      , p_file_name in varchar2
      , p_encoding in varchar2 := null
        return blob;
      function get_file(
        p_zipped_blob in blob
      , p_file_name in varchar2
      , p_encoding in varchar2 := null
        return blob;
      procedure add1file(
        p_zipped_blob in out blob
      , p_name in varchar2
      , p_content in blob
      procedure finish_zip(
        p_zipped_blob in out blob
      procedure save_zip(
        p_zipped_blob in blob
      , p_dir in varchar2 := 'MY_DIR'
      , p_filename in varchar2 := 'my.zip'
    declare
      g_zipped_blob blob;
    begin
      as_zip.add1file( g_zipped_blob, 'test1.txt', utl_raw.cast_to_raw( 'Dit is de laatste test! Waarom wordt dit dan niet gecomprimeerd?' ) );
      as_zip.add1file( g_zipped_blob, 'test1234.txt', utl_raw.cast_to_raw( 'En hier staat wat anders' ) );
      as_zip.finish_zip( g_zipped_blob );
      as_zip.save_zip( g_zipped_blob, 'MY_DIR', 'my.zip' );
    end;
    declare
      t_dir varchar2(100) := 'MY_DIR';
      t_zip varchar2(100) := 'my.zip';
      zip_files as_zip.file_list;
    begin
      zip_files  := as_zip.get_file_list( t_dir, t_zip );
      for i in zip_files.first() .. zip_files.last
      loop
        dbms_output.put_line( zip_files( i ) );
        dbms_output.put_line( utl_raw.cast_to_varchar2( as_zip.get_file( t_dir, t_zip, zip_files( i ) ) ) );
      end loop;
    end;
    end;
    CREATE OR REPLACE package body as_zip
    is
      function raw2num(
        p_value in raw
        return number
      is
      begin                                               -- note: FFFFFFFF => -1
        return utl_raw.cast_to_binary_integer( p_value
                                             , utl_raw.little_endian
      end;
      function file2blob(
        p_dir in varchar2
      , p_file_name in varchar2
        return blob
      is
        file_lob bfile;
        file_blob blob;
      begin
        file_lob := bfilename( p_dir
                             , p_file_name
        dbms_lob.open( file_lob
                     , dbms_lob.file_readonly
        dbms_lob.createtemporary( file_blob
                                , true
        dbms_lob.loadfromfile( file_blob
                             , file_lob
                             , dbms_lob.lobmaxsize
        dbms_lob.close( file_lob );
        return file_blob;
      exception
        when others
        then
          if dbms_lob.isopen( file_lob ) = 1
          then
            dbms_lob.close( file_lob );
          end if;
          if dbms_lob.istemporary( file_blob ) = 1
          then
            dbms_lob.freetemporary( file_blob );
          end if;
          raise;
      end;
      function raw2varchar2(
        p_raw in raw
      , p_encoding in varchar2
        return varchar2
      is
      begin
        return nvl
                ( utl_i18n.raw_to_char( p_raw
                                      , p_encoding
                , utl_i18n.raw_to_char
                                ( p_raw
                                , utl_i18n.map_charset( p_encoding
                                                      , utl_i18n.generic_context
                                                      , utl_i18n.iana_to_oracle
      end;
      function get_file_list(
        p_dir in varchar2
      , p_zip_file in varchar2
      , p_encoding in varchar2 := null
        return file_list
      is
      begin
        return get_file_list( file2blob( p_dir
                                       , p_zip_file
                            , p_encoding
      end;
      function get_file_list(
        p_zipped_blob in blob
      , p_encoding in varchar2 := null
        return file_list
      is
        t_ind integer;
        t_hd_ind integer;
        t_rv file_list;
      begin
        t_ind := dbms_lob.getlength( p_zipped_blob ) - 21;
        loop
          exit when dbms_lob.substr( p_zipped_blob
                                   , 4
                                   , t_ind
                                   ) = hextoraw( '504B0506' )
                or t_ind < 1;
          t_ind := t_ind - 1;
        end loop;
        if t_ind <= 0
        then
          return null;
        end if;
        t_hd_ind := raw2num( dbms_lob.substr( p_zipped_blob
                                            , 4
                                            , t_ind + 16
                                            ) ) + 1;
        t_rv := file_list( );
        t_rv.extend( raw2num( dbms_lob.substr( p_zipped_blob
                                             , 2
                                             , t_ind + 10
        for i in 1 .. raw2num( dbms_lob.substr( p_zipped_blob
                                              , 2
                                              , t_ind + 8
        loop
          t_rv( i ) :=
            raw2varchar2
                 ( dbms_lob.substr( p_zipped_blob
                                  , raw2num( dbms_lob.substr( p_zipped_blob
                                                            , 2
                                                            , t_hd_ind + 28
                                  , t_hd_ind + 46
                 , p_encoding
          t_hd_ind :=
              t_hd_ind
            + 46
            + raw2num( dbms_lob.substr( p_zipped_blob
                                      , 2
                                      , t_hd_ind + 28
            + raw2num( dbms_lob.substr( p_zipped_blob
                                      , 2
                                      , t_hd_ind + 30
            + raw2num( dbms_lob.substr( p_zipped_blob
                                      , 2
                                      , t_hd_ind + 32
        end loop;
        return t_rv;
      end;
      function get_file(
        p_dir in varchar2
      , p_zip_file in varchar2
      , p_file_name in varchar2
      , p_encoding in varchar2 := null
        return blob
      is
      begin
        return get_file( file2blob( p_dir
                                  , p_zip_file
                       , p_file_name
                       , p_encoding
      end;
      function get_file(
        p_zipped_blob in blob
      , p_file_name in varchar2
      , p_encoding in varchar2 := null
        return blob
      is
        t_tmp blob;
        t_ind integer;
        t_hd_ind integer;
        t_fl_ind integer;
      begin
        t_ind := dbms_lob.getlength( p_zipped_blob ) - 21;
        loop
          exit when dbms_lob.substr( p_zipped_blob
                                   , 4
                                   , t_ind
                                   ) = hextoraw( '504B0506' )
                or t_ind < 1;
          t_ind := t_ind - 1;
        end loop;
        if t_ind <= 0
        then
          return null;
        end if;
        t_hd_ind := raw2num( dbms_lob.substr( p_zipped_blob
                                            , 4
                                            , t_ind + 16
                                            ) ) + 1;
        for i in 1 .. raw2num( dbms_lob.substr( p_zipped_blob
                                              , 2
                                              , t_ind + 8
        loop
          if p_file_name =
               raw2varchar2
                 ( dbms_lob.substr( p_zipped_blob
                                  , raw2num( dbms_lob.substr( p_zipped_blob
                                                            , 2
                                                            , t_hd_ind + 28
                                  , t_hd_ind + 46
                 , p_encoding
          then
            if dbms_lob.substr( p_zipped_blob
                              , 2
                              , t_hd_ind + 10
                              ) = hextoraw( '0800' )                -- deflate
            then
              t_fl_ind :=
                    raw2num( dbms_lob.substr( p_zipped_blob
                                            , 4
                                            , t_hd_ind + 42
              t_tmp := hextoraw( '1F8B0800000000000003' );          -- gzip header
              dbms_lob.copy( t_tmp
                           , p_zipped_blob
                           , raw2num( dbms_lob.substr( p_zipped_blob
                                                     , 4
                                                     , t_fl_ind + 19
                           , 11
                           ,   t_fl_ind
                             + 31
                             + raw2num( dbms_lob.substr( p_zipped_blob
                                                       , 2
                                                       , t_fl_ind + 27
                             + raw2num( dbms_lob.substr( p_zipped_blob
                                                       , 2
                                                       , t_fl_ind + 29
              dbms_lob.append( t_tmp
                             , dbms_lob.substr( p_zipped_blob
                                              , 4
                                              , t_fl_ind + 15
              dbms_lob.append( t_tmp
                             , dbms_lob.substr( p_zipped_blob, 4, t_fl_ind + 23 )
              return utl_compress.lz_uncompress( t_tmp );
            end if;
            if dbms_lob.substr( p_zipped_blob
                              , 2
                              , t_hd_ind + 10
                              ) =
                          hextoraw( '0000' )
                                            -- The file is stored (no compression)
            then
              t_fl_ind :=
                    raw2num( dbms_lob.substr( p_zipped_blob
                                            , 4
                                            , t_hd_ind + 42
              return dbms_lob.substr( p_zipped_blob
                                    , raw2num( dbms_lob.substr( p_zipped_blob
                                                              , 4
                                                              , t_fl_ind + 19
                                    ,   t_fl_ind
                                      + 31
                                      + raw2num( dbms_lob.substr( p_zipped_blob
                                                                , 2
                                                                , t_fl_ind + 27
                                      + raw2num( dbms_lob.substr( p_zipped_blob
                                                                , 2
                                                                , t_fl_ind + 29
            end if;
          end if;
          t_hd_ind :=
              t_hd_ind
            + 46
            + raw2num( dbms_lob.substr( p_zipped_blob
                                      , 2
                                      , t_hd_ind + 28
            + raw2num( dbms_lob.substr( p_zipped_blob
                                      , 2
                                      , t_hd_ind + 30
            + raw2num( dbms_lob.substr( p_zipped_blob
                                      , 2
                                      , t_hd_ind + 32
        end loop;
        return null;
      end;
      function little_endian(
        p_big in number
      , p_bytes in pls_integer := 4
        return raw
      is
      begin
        return utl_raw.substr
                      ( utl_raw.cast_from_binary_integer( p_big
                                                        , utl_raw.little_endian
                      , 1
                      , p_bytes
      end;
      procedure add1file(
        p_zipped_blob in out blob
      , p_name in varchar2
      , p_content in blob
      is
        t_now date;
        t_blob blob;
        t_clen integer;
      begin
        t_now := sysdate;
        t_blob := utl_compress.lz_compress( p_content );
        t_clen := dbms_lob.getlength( t_blob );
        if p_zipped_blob is null
        then
          dbms_lob.createtemporary( p_zipped_blob
                                  , true
        end if;
        dbms_lob.append
          ( p_zipped_blob
          , utl_raw.concat
              ( hextoraw( '504B0304' )              -- Local file header signature
              , hextoraw( '1400' )                  -- version 2.0
              , hextoraw( '0000' )                  -- no General purpose bits
              , hextoraw( '0800' )                  -- deflate
              , little_endian
                  (   to_number( to_char( t_now
                                        , 'ss'
                                        ) ) / 2
                    + to_number( to_char( t_now
                                        , 'mi'
                                        ) ) * 32
                    + to_number( to_char( t_now
                                        , 'hh24'
                                        ) ) * 2048
                  , 2
                  )                                 -- File last modification time
              , little_endian
                  (   to_number( to_char( t_now
                                        , 'dd'
                    + to_number( to_char( t_now
                                        , 'mm'
                                        ) ) * 32
                    + ( to_number( to_char( t_now
                                          , 'yyyy'
                                          ) ) - 1980 ) * 512
                  , 2
                  )                                 -- File last modification date
              , dbms_lob.substr( t_blob
                               , 4
                               , t_clen - 7
                               )                                         -- CRC-32
              , little_endian( t_clen - 18 )                    -- compressed size
              , little_endian( dbms_lob.getlength( p_content ) )
                                                              -- uncompressed size
              , little_endian( length( p_name )
                             , 2
                             )                                 -- File name length
              , hextoraw( '0000' )                           -- Extra field length
              , utl_raw.cast_to_raw( p_name )                         -- File name
        dbms_lob.copy( p_zipped_blob
                     , t_blob
                     , t_clen - 18
                     , dbms_lob.getlength( p_zipped_blob ) + 1
                     , 11
                     );                                      -- compressed content
        dbms_lob.freetemporary( t_blob );
      end;
      procedure finish_zip(
        p_zipped_blob in out blob
      is
        t_cnt pls_integer := 0;
        t_offs integer;
        t_offs_dir_header integer;
        t_offs_end_header integer;
        t_comment raw( 32767 )
                     := utl_raw.cast_to_raw( 'Implementation by Anton Scheffer' );
      begin
        t_offs_dir_header := dbms_lob.getlength( p_zipped_blob );
        t_offs := dbms_lob.instr( p_zipped_blob
                                , hextoraw( '504B0304' )
                                , 1
        while t_offs > 0
        loop
          t_cnt := t_cnt + 1;
          dbms_lob.append
            ( p_zipped_blob
            , utl_raw.concat
                ( hextoraw( '504B0102' )
                                        -- Central directory file header signature
                , hextoraw( '1400' )                                -- version 2.0
                , dbms_lob.substr( p_zipped_blob
                                 , 26
                                 , t_offs + 4
                , hextoraw( '0000' )                        -- File comment length
                , hextoraw( '0000' )              -- Disk number where file starts
                , hextoraw( '0100' )                   -- Internal file attributes
                , hextoraw( '2000B681' )               -- External file attributes
                , little_endian( t_offs - 1 )
                                           -- Relative offset of local file header
                , dbms_lob.substr
                    ( p_zipped_blob
                    , utl_raw.cast_to_binary_integer
                                               ( dbms_lob.substr( p_zipped_blob
                                                                , 2
                                                                , t_offs + 26
                                               , utl_raw.little_endian
                    , t_offs + 30
                    )                                                 -- File name
          t_offs :=
              dbms_lob.instr( p_zipped_blob
                            , hextoraw( '504B0304' )
                            , t_offs + 32
        end loop;
        t_offs_end_header := dbms_lob.getlength( p_zipped_blob );
        dbms_lob.append
          ( p_zipped_blob
          , utl_raw.concat
              ( hextoraw( '504B0506' )       -- End of central directory signature
              , hextoraw( '0000' )                          -- Number of this disk
              , hextoraw( '0000' )          -- Disk where central directory starts
              , little_endian
                       ( t_cnt
                       , 2
                       )       -- Number of central directory records on this disk
              , little_endian( t_cnt
                             , 2
                             )        -- Total number of central directory records
              , little_endian( t_offs_end_header - t_offs_dir_header )
                                                      -- Size of central directory
              , little_endian
                        ( t_offs_dir_header )
                                           -- Relative offset of local file header
              , little_endian
                    ( nvl( utl_raw.length( t_comment )
                         , 0
                    , 2
                    )                                   -- ZIP file comment length
              , t_comment
      end;
      procedure save_zip(
        p_zipped_blob in blob
      , p_dir in varchar2 := 'MY_DIR'
      , p_filename in varchar2 := 'my.zip'
      is
        t_fh utl_file.file_type;
        t_len pls_integer := 32767;
      begin
        t_fh := utl_file.fopen( p_dir
                              , p_filename
                              , 'wb'
        for i in 0 .. trunc(  ( dbms_lob.getlength( p_zipped_blob ) - 1 ) / t_len )
        loop
          utl_file.put_raw( t_fh
                          , dbms_lob.substr( p_zipped_blob
                                           , t_len
                                           , i * t_len + 1
        end loop;
        utl_file.fclose( t_fh );
      end;
    end;
    /

  • Create windows folder with PL/SQL only

    Hi
    I need to create a folder using PL/SQL only.
    We are using Oracle 10.2.0.1.0
    Thanks.

    No can do. Not with PL/SQL alone. You'd need a Java Stored Procedure and even then, it would create folders on the server.
    Why would you use a database for OS administration?
    Message was edited by:
    maaher

  • Unabel to Import XML file in Internet Explorer 9 Using PHP

    I have created a project Using PHP in which i need to import a xml file for my further use, I am able to import XML File  in IE 10 & IE11 but unable to import in IE9. 

    Hi Sunil,
    I recommend that you post in some PHP related forums, since this forum is only for VSTO related questions.
    Thanks for your understanding.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How to create custom folder for parameterized query

    Hi Gurus,
    I developed a query to generate report to " who is reporting to who in organization", when i am trying to create custom folder using this query but i am getting error like "The custom sql entered contains parameter and therefore invalid". Could you please help to parameterize the emp_key in query in Oracle Discoverer. Is there any way to pass the value using external procedure for this query.
    SELECT
    lpad(' ', 8 *(LEVEL -1)) || emp_last_name, emp_key, manager_id, emp_key, manager_key,
    mgr_last_name, mgr_first_name, empid,
    emp_last_name, emp_first_name, LEVEL FROM cmp_ppl1 START WITH emp_key = &emp_key
    CONNECT BY PRIOR emp_key = manager_key;
    Thanks & Regards
    Vikram

    I agree 100% that it's way easier to create a dataview or a custom folder - with no run time parameters being passed to the EUL - as is being done by Vikram.
    The only concern I would have is that I don't know if it would work - or at least ever come back in reasonable time - for Vikram and therefore the question about parameters (only Vikram can say).
    The reason I'm wondering is that I've created SQL similar to being shown (when used in an org chart report at a large client) and the start / connect by is used for going down the tree getting everyone on the way. And if it's not limited - that could be a huge undertaking - of records and/or time. Guess it depends on how many people work at the organization (and of course, levels).
    But otherwise, absolutely, I would try and bring back all logical records to the folder and then filter in Disco.
    Russ

  • DW 8.0.2 Not creating Templates folder

    So today I went to create a template (first on this
    new , large site we are working on) and DW will not create the
    default templates folder. It keeps saving my .dwt in the root
    folder.
    Background. I have all the permissions in the world on this
    server - there are 4 sites I work on daily and two of them have
    templates created by DW MX and MX 2004. This is the first time I
    have tried to create templates for this particular site (on the
    same server as the others). DW is installed on my local machine and
    I do not EVER save any work locally, so if this is the solution -
    then it isn't good enough. We are required to work 100% on our
    servers for backup reason (don't get me started), which hasn't been
    a problem in the past. I use PUT/GET to move my files b/t servers
    (mockup/live). Again - never a problem in the last versions of DW,
    but for some reason 8.0.1 is having issues.
    Anyone have ANY ideas why DW 8.0.1 [Correction: 8.0.2] isn't
    creating the Templates folder it needs???
    Thnx,
    Chris

    > Is this wrong?
    Yes, only in that it's so error prone.
    If your template has two or more editable regions, you do not
    get the option
    to divide your content between them. All of your content must
    go into one
    of those two.
    > If there is a quicker way - let me know!
    There is not.
    > it is plopping my
    > template straight into my root.
    Are you using FILE | Save As Template...?
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "halectx" <[email protected]> wrote in
    message
    news:[email protected]...
    > Hmmm. Maybe I am not using templates correctly. I have
    100+ pages that
    > all
    > have to look the same. There is already content in them.
    They are stripped
    > clean of all formatting/styles. I need to apply the
    template to the page.
    > I've
    > done this NUMEROUS times in the past (came in handy
    while creating our
    > company
    > intranet) using DW. Not sure which versions, since I
    have used all of
    > them at
    > various times.
    >
    > Can you be a little more clear? I have a file open, for
    example
    > ballast.htm.
    > I want to apply the template to the file - I go to
    "Apply Template" select
    > the
    > template to apply - tell it where to place the body,
    etc. And ... my page
    > has
    > the template applied. This is the method I've used in
    the past. I then
    > save
    > the file (ballast.htm) and move to the next one. I know
    there is probably
    > a
    > batch process out there, but I haven't looked that far.
    >
    > Is this wrong? If there is a quicker way - let me know!
    >
    > Yes, I agree - It won't save the templates folder until
    you do a save the
    > file
    > (regardless of how it is created) as a template. There
    in lies my
    > problem.
    > When I do this, it isn't creating the Templates folder -
    it is plopping my
    > template straight into my root.
    >
    > I'm getting ready to open my MX 2004 and try to just
    create the folder
    > using
    > it and then go back to my DW8. Wish me luck!
    >

Maybe you are looking for