bonjour,

je souhaite uploader une image via un web forms qui ne marche pas

la table
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
create table S719_OA_IMAGES
(
  oai_id   NUMBER(10) not null,
  oa_name  VARCHAR2(255),
  oa_image BLOB
);
 
-- Create/Recreate indexes 
create index S719_OAI_NAME_NI on S719_OA_IMAGES (OA_NAME);
 
-- Create/Recreate primary, unique and foreign key constraints 
alter table S719_OA_IMAGES
  add constraint S719_OAI_PK primary key (OAI_ID);
 
CREATE SEQUENCE S719_OAI_SEQ;
le package
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
create or replace package s719_pa_oa_images as
 
  procedure p_test;
  procedure p_web_image(piv_name in s719_oa_images.oa_name%type);
  /* 
     NAME : p_load_binary_from_url 
     SCOPE : store image into db using http link
     CODE SAMPLE : 
     BEGIN
       s719_pa_oa_images.p_load_binary_from_url('TEST','http://server/pobtrans.gif');
     END ;
            
  */
  procedure p_load_binary_from_url(piv_oa_name varchar,
                                   piv_url     in varchar2);
 
  procedure p_frm_upload;
 
  procedure p_upload_image(piv_oa_name in varchar2,
                           piv_file    in varchar2 := null);
 
end s719_pa_oa_images;
/
 
 
create or replace package body s719_pa_oa_images as
 
  procedure p_web_image(piv_name in s719_oa_images.oa_name%type) as
    ln_length number;
 
    ll_blob blob;
 
    ln_amt number default 30;
    ln_off number default 1;
    ll_raw raw(4096);
 
  begin
    if piv_name is not null then
      -- test     
      select i.oa_image
        into ll_blob
        from s719_oa_images i
       where oa_name = piv_name;
 
      if ll_blob is not null then
        ln_length := dbms_lob.getlength(ll_blob);
        owa_util.mime_header('image/jpg', false, null);
        htp.p('Content-length: ' || ln_length);
 
        htp.p('Pragma: no-cache');
        htp.p('Cache-Control: no-cache');
        htp.p('Expires: Thu, 01 Jan 1970 12:00:00 GMT');
        owa_util.http_header_close;
 
        if ln_length > 0 then
          begin
            loop
              dbms_lob.read(ll_blob, ln_amt, ln_off, ll_raw);
              htp.prn(utl_raw.cast_to_varchar2(ll_raw));
              ln_off := ln_off + ln_amt;
              ln_amt := 4096;
            end loop;
          exception
            when no_data_found then
              htp.prn(sqlerrm);
              null;
          end;
        end if;
        dbms_lob.close(ll_blob);
      end if;
    end if;
  exception
    when others then
      null;
      --      htp.prn(piv_name);
    --      htp.prn(sqlerrm);
  end p_web_image;
 
  procedure p_test is
  begin
    htp.print('s719_pa_oa_images.p_test ' ||
              to_char(sysdate, 'YYYY/MM/DD HH24:MI:SSSS'));
  end p_test;
 
  /* 
     NAME : p_load_binary_from_url 
     SCOPE : store image into db using http link
     CODE SAMPLE : 
     BEGIN
       s719_pa_oa_images.p_load_binary_from_url('TEST','http://server/images/pobtrans.gif');
     END ;
            
  */
  procedure p_load_binary_from_url(piv_oa_name varchar,
                                   piv_url     in varchar2) as
    ll_blob blob;
  begin
    ll_blob := httpuritype.createuri(piv_url).getblob();
 
    -- Insert the data into the table.
    insert into s719_oa_images
      (oai_id, oa_image, oa_name)
    values
      (s719_oai_seq.nextval, ll_blob, piv_oa_name);
 
  end p_load_binary_from_url;
 
  procedure p_upload_image(piv_oa_name in varchar2,
                           piv_file    in varchar2 := null) is
    ll_blob blob;
  begin
 
    ll_blob := utl_raw.cast_to_raw(piv_file);
    insert into s719_oa_images
      (oai_id, oa_image, oa_name)
    values
      (s719_oai_seq.nextval, ll_blob, piv_oa_name);
 
    htp.htmlopen;
    htp.headopen;
    htp.title('File Uploaded');
    htp.headclose;
    htp.bodyopen;
    htp.header(1, 'Upload Status');
    htp.print('Uploaded ' || piv_oa_name || ' successfully');
    htp.bodyclose;
    htp.htmlclose;
  end p_upload_image;
 
  procedure p_frm_upload is
  begin
 
    htp.htmlopen;
    htp.headopen;
    htp.p('<title>test upload</title>');
    htp.headclose;
    htp.bodyopen;
    htp.p(q'[<FORM enctype="multipart/form-data"
                   action="s719_pa_oa_images.p_upload_image"
                   method="POST">]');
    htp.p(q'[<p>OA File Name:<INPUT type="text" name="piv_oa_name"><br>]');
    htp.p(q'[<p>File to upload:<INPUT type="file" name="piv_file"><br>]');
    htp.p(q'[<p><INPUT type="submit" value="Store OA Picture Now">]');
    htp.formclose;
    htp.bodyclose;
    htp.htmlclose;
 
  end p_frm_upload;
 
end s719_pa_oa_images;
lorque je lance p_frm_upload l'appel a s719_pa_oa_images.p_upload_image ne fonctionne pas.


mon formulaire s'affiche bien mais le stockage de l'image plante.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
 
Not Found
 
The requested URL /D716_F_D/s719_pa_oa_images.p_upload_image was not found on this server.
Oracle-Application-Server-10g/10.1.2.2.0 Oracle-HTTP-Server Server at ux Port 52919
Qu'est ce qui ne marche pas ?

merci